add new pipeline settings
This commit is contained in:
48
Jenkinsfile
vendored
48
Jenkinsfile
vendored
@@ -22,13 +22,19 @@ pipeline {
|
|||||||
|
|
||||||
stages {
|
stages {
|
||||||
|
|
||||||
stage('pulling master') {
|
stage('pull master') {
|
||||||
steps {
|
steps {
|
||||||
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
|
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
|
||||||
sh '''git config user.name "Jenkins Server"
|
sh '''
|
||||||
git config user.email jenkins@confdroid.com
|
git config user.name "Jenkins Server"
|
||||||
git pull origin master
|
git config user.email jenkins@confdroid.com
|
||||||
git checkout -b jenkins '''
|
# Ensure we're on the development branch (triggered by push)
|
||||||
|
git checkout development
|
||||||
|
# Create jenkins branch from development
|
||||||
|
git checkout -b jenkins-build-$BUILD_NUMBER
|
||||||
|
# Optionally merge master into jenkins to ensure compatibility
|
||||||
|
git merge origin/master --no-ff || { echo "Merge conflict detected"; exit 1; }
|
||||||
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -51,21 +57,25 @@ pipeline {
|
|||||||
|
|
||||||
stage('puppet-lint') {
|
stage('puppet-lint') {
|
||||||
steps {
|
steps {
|
||||||
sh '''/usr/local/bin/puppet-lint .
|
sh '''/usr/local/bin/puppet-lint . \\
|
||||||
|
--no-variable_scope-check \\
|
||||||
|
|| { echo "Puppet lint failed"; exit 1; }
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('SonarScan') {
|
stage('SonarScan') {
|
||||||
steps {
|
steps {
|
||||||
sh '''
|
withCredentials([string(credentialsId: 'sonar-token', variable: 'SONAR_TOKEN')]) {
|
||||||
/opt/sonar-scanner/bin/sonar-scanner \
|
sh '''
|
||||||
-Dsonar.projectKey=cd_apache \
|
/opt/sonar-scanner/bin/sonar-scanner \
|
||||||
-Dsonar.sources=. \
|
-Dsonar.projectKey=cd_apache \
|
||||||
-Dsonar.host.url=https://sonarqube.confdroid.com \
|
-Dsonar.sources=. \
|
||||||
-Dsonar.token=sqa_aca21cc41336d0f31987ed196ccfb9be55ded774
|
-Dsonar.host.url=https://sonarqube.confdroid.com \
|
||||||
'''
|
-Dsonar.token=$SONAR_TOKEN
|
||||||
}
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('create Puppet documentation') {
|
stage('create Puppet documentation') {
|
||||||
@@ -77,10 +87,12 @@ pipeline {
|
|||||||
stage('update repo') {
|
stage('update repo') {
|
||||||
steps {
|
steps {
|
||||||
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
|
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
|
||||||
sh '''git config user.name "Jenkins Server"
|
sh '''
|
||||||
git config user.email jenkins@confdroid.com
|
git config user.name "Jenkins Server"
|
||||||
echo `git add -A && git commit -am "recommit for updates in build $BUILD_NUMBER"`
|
git config user.email jenkins@confdroid.com
|
||||||
git push origin HEAD:master'''
|
git add -A && git commit -am "Recommit for updates in build $BUILD_NUMBER" || echo "No changes to commit"
|
||||||
|
git push origin HEAD:master
|
||||||
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user