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 c1a8a40 commit 2025fac
Showing 1 changed file with 39 additions and 47 deletions.
86 changes: 39 additions & 47 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.10'
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 @@ -50,8 +53,15 @@ try {
}
}
},
'centos8': {
node {
'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"
}
},
'build centos8': {
node("C++") {
sh 'setup_centreon_build.sh'
sh "./centreon-build/jobs/broker/${serie}/mon-broker-unittest.sh centos8"
step([
Expand All @@ -64,8 +74,15 @@ try {
])
}
},
'debian10': {
node {
'packaging centos8': {
node("C++") {
sh 'setup_centreon_build.sh'
sh "./centreon-build/jobs/broker/${serie}/mon-broker-package.sh centos8"
stash name: 'el8-rpms', includes: "output/x86_64/*.rpm"
}
},
'build debian10': {
node("C++") {
sh 'setup_centreon_build.sh'
sh "./centreon-build/jobs/broker/${serie}/mon-broker-unittest.sh debian10"
step([
Expand All @@ -77,16 +94,21 @@ try {
tools: [[$class: 'GoogleTestType', pattern: 'ut.xml']]
])
}
},
'packaging debian10': {
node("C++") {
sh 'setup_centreon_build.sh'
sh "./centreon-build/jobs/broker/${serie}/mon-broker-package.sh debian10"
}
}
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 @@ -97,41 +119,11 @@ try {
}
}

stage('Package') {
parallel 'centos7': {
node {
sh 'setup_centreon_build.sh'
sh "./centreon-build/jobs/broker/${serie}/mon-broker-package.sh centos7"
}
},
'centos8': {
node {
sh 'setup_centreon_build.sh'
sh "./centreon-build/jobs/broker/${serie}/mon-broker-package.sh centos8"
}
},
'debian10': {
node {
sh 'setup_centreon_build.sh'
sh "./centreon-build/jobs/broker/${serie}/mon-broker-package.sh debian10"
}
/*
},
'debian10-armhf': {
node {
sh 'setup_centreon_build.sh'
sh "./centreon-build/jobs/broker/${serie}/mon-broker-package.sh debian10-armhf"
}
*/
}
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 2025fac

Please sign in to comment.