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') {
|
||||
node {
|
||||
|
@ -14,36 +20,41 @@ stage('Source') {
|
|||
withSonarQubeEnv('SonarQubeDev') {
|
||||
sh './centreon-build/jobs/plugins/plugins-analysis.sh'
|
||||
}
|
||||
def qualityGate = waitForQualityGate()
|
||||
if (qualityGate.status != 'OK') {
|
||||
currentBuild.result = 'FAIL'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// sonarQube step to get qualityGate result
|
||||
stage('Quality gate') {
|
||||
stage('RPM Packaging') {
|
||||
parallel 'all': {
|
||||
node {
|
||||
def qualityGate = waitForQualityGate()
|
||||
if (qualityGate.status != 'OK') {
|
||||
currentBuild.result = 'FAIL'
|
||||
}
|
||||
if ((currentBuild.result ?: 'SUCCESS') != 'SUCCESS') {
|
||||
error("Quality gate failure: ${qualityGate.status}.");
|
||||
}
|
||||
sh 'setup_centreon_build.sh'
|
||||
sh './centreon-build/jobs/plugins/plugins-package.sh'
|
||||
archiveArtifacts artifacts: 'rpms-centos7.tar.gz'
|
||||
archiveArtifacts artifacts: 'rpms-centos8.tar.gz'
|
||||
stash name: "rpms-centos7", includes: 'output-centos7/noarch/*.rpm'
|
||||
stash name: "rpms-centos8", includes: 'output-centos8/noarch/*.rpm'
|
||||
sh 'rm -rf output'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Package') {
|
||||
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}"
|
||||
if ((currentBuild.result ?: 'SUCCESS') != 'SUCCESS') {
|
||||
error('Package stage failure.');
|
||||
}
|
||||
}
|
||||
|
||||
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