Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

Commit

Permalink
enh(ci): New packaging workflow and more // jobs (#647)
Browse files Browse the repository at this point in the history
* deliver only for qa and release branches

* remove old import

* adding CI branches as delivery branches for testing purpose

* editing fixme

* removing fixme

* comments for testing purpose

* using specific c++ nodes

* stashing rpms

* packaging parallelised with build

* keep only ten jobs in history

* fixing parallel call for packaging
Conflicts:
	Jenkinsfile
  • Loading branch information
zguennoune02 committed Aug 30, 2021
1 parent 8892a3b commit 5c7929f
Showing 1 changed file with 22 additions and 23 deletions.
45 changes: 22 additions & 23 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
import groovy.json.JsonSlurper

/*
** Variables.
*/
properties([buildDiscarder(logRotator(numToKeepStr: '50'))])
def serie = '20.04'
def maintenanceBranch = "${serie}.x"
def qaBranch = "dev-${serie}"

if (env.BRANCH_NAME.startsWith('release-')) {
env.BUILD = 'RELEASE'
} else if ((env.BRANCH_NAME == 'master') || (env.BRANCH_NAME == maintenanceBranch)) {
env.BUILD = 'REFERENCE'
} else if ((env.BRANCH_NAME == 'develop') || (env.BRANCH_NAME == qaBranch)) {
env.BUILD = 'QA'
} else {
env.BUILD = 'CI'
}

/*
** Pipeline code.
*/
stage('Source') {
node {
stage('Deliver sources') {
node("C++") {
sh 'setup_centreon_build.sh'
dir('centreon-broker') {
checkout scm
Expand All @@ -31,9 +34,9 @@ stage('Source') {
}

try {
stage('Unit tests') {
parallel 'centos7': {
node {
stage('Build // Unit tests // Packaging') {
parallel 'build centos7': {
node("C++") {
sh 'setup_centreon_build.sh'
sh "./centreon-build/jobs/broker/${serie}/mon-broker-unittest.sh centos7"
step([
Expand All @@ -49,16 +52,22 @@ try {
sh "./centreon-build/jobs/broker/${serie}/mon-broker-analysis.sh"
}
}
},
'packaging centos7': {
node("C++") {
sh 'setup_centreon_build.sh'
sh "./centreon-build/jobs/broker/${serie}/mon-broker-package.sh centos7"
stash name: 'el7-rpms', includes: "output/x86_64/*.rpm"
}
}
if ((currentBuild.result ?: 'SUCCESS') != 'SUCCESS') {
error('Unit tests stage failure.');
error('Build // Unit tests // Packaging.');
}
}

// sonarQube step to get qualityGate result
stage('Quality gate') {
node {
sleep 120
node("C++") {
def qualityGate = waitForQualityGate()
if (qualityGate.status != 'OK') {
currentBuild.result = 'FAIL'
Expand All @@ -69,21 +78,11 @@ try {
}
}

stage('Package') {
parallel 'centos7': {
node {
sh 'setup_centreon_build.sh'
sh "./centreon-build/jobs/broker/${serie}/mon-broker-package.sh centos7"
}
}
if ((currentBuild.result ?: 'SUCCESS') != 'SUCCESS') {
error('Package stage failure.');
}
}

if ((env.BUILD == 'RELEASE') || (env.BUILD == 'REFERENCE')) {
if ((env.BUILD == 'RELEASE') || (env.BUILD == 'QA')) {
stage('Delivery') {
node {
node("C++") {
unstash 'el7-rpms'
unstash 'el8-rpms'
sh 'setup_centreon_build.sh'
sh "./centreon-build/jobs/broker/${serie}/mon-broker-delivery.sh"
}
Expand Down

0 comments on commit 5c7929f

Please sign in to comment.