enh(ci): new delivery workflow (#3199)

This commit is contained in:
Zakaria Guennoune 2021-10-19 11:31:42 +02:00 committed by GitHub
parent 1dbc8aa362
commit 510047b2b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 37 additions and 26 deletions

43
Jenkinsfile vendored
View File

@ -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'
}
}
}
try {
// sonarQube step to get qualityGate result
stage('Quality gate') {
node {
def qualityGate = waitForQualityGate()
if (qualityGate.status != 'OK') {
currentBuild.result = 'FAIL'
}
if ((currentBuild.result ?: 'SUCCESS') != 'SUCCESS') {
error("Quality gate failure: ${qualityGate.status}.");
}
}
}
}
stage('Package') {
stage('RPM Packaging') {
parallel 'all': {
node {
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'
}
}
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'
}
} 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.');
}
}