|
2 | 2 | @Library('pipeline-library')_ |
3 | 3 |
|
4 | 4 | def schedule = env.BRANCH_NAME.contains('master') ? '@monthly' : env.BRANCH_NAME == 'develop' ? '@midnight' : '' |
| 5 | +def sonarBranchName = env.BRANCH_NAME.contains('master') ? '-Dsonar.branch.name=master' : '-Dsonar.branch.name=' + env.BRANCH_NAME |
| 6 | +def sonarBranchTarget = env.BRANCH_NAME.contains('master') ? '' : env.BRANCH_NAME == 'develop' ? '-Dsonar.branch.target=master' : '-Dsonar.branch.target=develop' |
5 | 7 |
|
6 | 8 | pipeline { |
7 | 9 |
|
@@ -55,14 +57,10 @@ pipeline { |
55 | 57 | options { |
56 | 58 | timeout(time: 30, unit: 'MINUTES') |
57 | 59 | } |
58 | | - environment { |
59 | | - SONAR_BRANCH_NAME = sh(returnStdout: true, script: '[ $BRANCH_NAME = master ] && echo || [ $BRANCH_NAME = develop ] && echo -Dsonar.branch.name=develop || echo -Dsonar.branch.name=$BRANCH_NAME').trim() |
60 | | - SONAR_BRANCH_TARGET = sh(returnStdout: true, script: '[ $BRANCH_NAME = master ] && echo || [ $BRANCH_NAME = develop ] && echo -Dsonar.branch.target=master || echo -Dsonar.branch.target=develop').trim() |
61 | | - } |
62 | 60 | steps { |
63 | 61 | withMaven(jdk: "${JDK_VERSION}", maven: 'M3') { |
64 | 62 | withSonarQubeEnv('Sonar') { |
65 | | - sh 'mvn --activate-profiles test verify -DgsExec="${gsExec}" -DcompareExec="${compareExec}" -Dmaven.test.skip=false -Dmaven.test.failure.ignore=false -Dmaven.javadoc.skip=true org.jacoco:jacoco-maven-plugin:prepare-agent org.jacoco:jacoco-maven-plugin:report sonar:sonar "${SONAR_BRANCH_NAME}" "${SONAR_BRANCH_TARGET}"' |
| 63 | + sh 'mvn --activate-profiles test -DgsExec="${gsExec}" -DcompareExec="${compareExec}" -Dmaven.test.skip=false -Dmaven.test.failure.ignore=false -Dmaven.javadoc.skip=true org.jacoco:jacoco-maven-plugin:prepare-agent verify org.jacoco:jacoco-maven-plugin:report sonar:sonar ' + sonarBranchName + ' ' + sonarBranchTarget |
66 | 64 | } |
67 | 65 | } |
68 | 66 | } |
@@ -135,14 +133,14 @@ pipeline { |
135 | 133 | } |
136 | 134 | fixed { |
137 | 135 | script { |
138 | | - if ((env.BRANCH_NAME == 'master') || (env.BRANCH_NAME == 'develop')) { |
| 136 | + if (env.BRANCH_NAME.contains('master') || (env.BRANCH_NAME == 'develop')) { |
139 | 137 | slackNotifier("#ci", currentBuild.currentResult, "${env.BRANCH_NAME} - Back to normal") |
140 | 138 | } |
141 | 139 | } |
142 | 140 | } |
143 | 141 | regression { |
144 | 142 | script { |
145 | | - if ((env.BRANCH_NAME == 'master') || (env.BRANCH_NAME == 'develop')) { |
| 143 | + if (env.BRANCH_NAME.contains('master') || (env.BRANCH_NAME == 'develop')) { |
146 | 144 | slackNotifier("#ci", currentBuild.currentResult, "${env.BRANCH_NAME} - First failure") |
147 | 145 | } |
148 | 146 | } |
|
0 commit comments