enh(ci): new delivery workflow (#3199)
This commit is contained in:
parent
1dbc8aa362
commit
510047b2b4
|
@ -1,4 +1,10 @@
|
||||||
properties([buildDiscarder(logRotator(numToKeepStr: '50'))])
|
|
||||||
|
env.REF_BRANCH = 'master'
|
||||||
|
if ((env.BRANCH_NAME == env.REF_BRANCH)) {
|
||||||
|
env.BUILD = 'REFERENCE'
|
||||||
|
} else {
|
||||||
|
env.BUILD = 'CI'
|
||||||
|
}
|
||||||
|
|
||||||
stage('Source') {
|
stage('Source') {
|
||||||
node {
|
node {
|
||||||
|
@ -14,36 +20,41 @@ stage('Source') {
|
||||||
withSonarQubeEnv('SonarQubeDev') {
|
withSonarQubeEnv('SonarQubeDev') {
|
||||||
sh './centreon-build/jobs/plugins/plugins-analysis.sh'
|
sh './centreon-build/jobs/plugins/plugins-analysis.sh'
|
||||||
}
|
}
|
||||||
|
def qualityGate = waitForQualityGate()
|
||||||
|
if (qualityGate.status != 'OK') {
|
||||||
|
currentBuild.result = 'FAIL'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
stage('RPM Packaging') {
|
||||||
// sonarQube step to get qualityGate result
|
parallel 'all': {
|
||||||
stage('Quality gate') {
|
|
||||||
node {
|
node {
|
||||||
def qualityGate = waitForQualityGate()
|
sh 'setup_centreon_build.sh'
|
||||||
if (qualityGate.status != 'OK') {
|
sh './centreon-build/jobs/plugins/plugins-package.sh'
|
||||||
currentBuild.result = 'FAIL'
|
archiveArtifacts artifacts: 'rpms-centos7.tar.gz'
|
||||||
}
|
archiveArtifacts artifacts: 'rpms-centos8.tar.gz'
|
||||||
if ((currentBuild.result ?: 'SUCCESS') != 'SUCCESS') {
|
stash name: "rpms-centos7", includes: 'output-centos7/noarch/*.rpm'
|
||||||
error("Quality gate failure: ${qualityGate.status}.");
|
stash name: "rpms-centos8", includes: 'output-centos8/noarch/*.rpm'
|
||||||
}
|
sh 'rm -rf output'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ((currentBuild.result ?: 'SUCCESS') != 'SUCCESS') {
|
||||||
stage('Package') {
|
error('Package stage failure.');
|
||||||
parallel 'all': {
|
|
||||||
node {
|
|
||||||
sh 'setup_centreon_build.sh'
|
|
||||||
sh './centreon-build/jobs/plugins/plugins-package.sh'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((currentBuild.result ?: 'SUCCESS') != 'SUCCESS') {
|
|
||||||
error('Package stage failure.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch(e) {
|
|
||||||
if (env.BRANCH_NAME == 'master') {
|
|
||||||
slackSend channel: "#monitoring-metrology", color: "#F30031", message: "*FAILURE*: `CENTREON PLUGINS` <${env.BUILD_URL}|build #${env.BUILD_NUMBER}> on branch ${env.BRANCH_NAME}\n*COMMIT*: <https://github.com/centreon/centreon-plugins/commit/${source.COMMIT}|here> by ${source.COMMITTER}\n*INFO*: ${e}"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stage('RPM Delivery') {
|
||||||
|
parallel 'all': {
|
||||||
|
node {
|
||||||
|
sh 'setup_centreon_build.sh'
|
||||||
|
unstash 'rpms-centos7'
|
||||||
|
unstash 'rpms-centos8'
|
||||||
|
sh './centreon-build/jobs/plugins/plugins-delivery.sh'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((currentBuild.result ?: 'SUCCESS') != 'SUCCESS') {
|
||||||
|
error('Package stage failure.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue