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

Commit 5c7929f

Browse files
committed
enh(ci): New packaging workflow and more // jobs (#647)
* 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
1 parent 8892a3b commit 5c7929f

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

Jenkinsfile

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
1-
import groovy.json.JsonSlurper
21

32
/*
43
** Variables.
54
*/
65
properties([buildDiscarder(logRotator(numToKeepStr: '50'))])
76
def serie = '20.04'
87
def maintenanceBranch = "${serie}.x"
8+
def qaBranch = "dev-${serie}"
9+
910
if (env.BRANCH_NAME.startsWith('release-')) {
1011
env.BUILD = 'RELEASE'
1112
} else if ((env.BRANCH_NAME == 'master') || (env.BRANCH_NAME == maintenanceBranch)) {
1213
env.BUILD = 'REFERENCE'
14+
} else if ((env.BRANCH_NAME == 'develop') || (env.BRANCH_NAME == qaBranch)) {
15+
env.BUILD = 'QA'
1316
} else {
1417
env.BUILD = 'CI'
1518
}
1619

1720
/*
1821
** Pipeline code.
1922
*/
20-
stage('Source') {
21-
node {
23+
stage('Deliver sources') {
24+
node("C++") {
2225
sh 'setup_centreon_build.sh'
2326
dir('centreon-broker') {
2427
checkout scm
@@ -31,9 +34,9 @@ stage('Source') {
3134
}
3235

3336
try {
34-
stage('Unit tests') {
35-
parallel 'centos7': {
36-
node {
37+
stage('Build // Unit tests // Packaging') {
38+
parallel 'build centos7': {
39+
node("C++") {
3740
sh 'setup_centreon_build.sh'
3841
sh "./centreon-build/jobs/broker/${serie}/mon-broker-unittest.sh centos7"
3942
step([
@@ -49,16 +52,22 @@ try {
4952
sh "./centreon-build/jobs/broker/${serie}/mon-broker-analysis.sh"
5053
}
5154
}
55+
},
56+
'packaging centos7': {
57+
node("C++") {
58+
sh 'setup_centreon_build.sh'
59+
sh "./centreon-build/jobs/broker/${serie}/mon-broker-package.sh centos7"
60+
stash name: 'el7-rpms', includes: "output/x86_64/*.rpm"
61+
}
5262
}
5363
if ((currentBuild.result ?: 'SUCCESS') != 'SUCCESS') {
54-
error('Unit tests stage failure.');
64+
error('Build // Unit tests // Packaging.');
5565
}
5666
}
5767

5868
// sonarQube step to get qualityGate result
5969
stage('Quality gate') {
60-
node {
61-
sleep 120
70+
node("C++") {
6271
def qualityGate = waitForQualityGate()
6372
if (qualityGate.status != 'OK') {
6473
currentBuild.result = 'FAIL'
@@ -69,21 +78,11 @@ try {
6978
}
7079
}
7180

72-
stage('Package') {
73-
parallel 'centos7': {
74-
node {
75-
sh 'setup_centreon_build.sh'
76-
sh "./centreon-build/jobs/broker/${serie}/mon-broker-package.sh centos7"
77-
}
78-
}
79-
if ((currentBuild.result ?: 'SUCCESS') != 'SUCCESS') {
80-
error('Package stage failure.');
81-
}
82-
}
83-
84-
if ((env.BUILD == 'RELEASE') || (env.BUILD == 'REFERENCE')) {
81+
if ((env.BUILD == 'RELEASE') || (env.BUILD == 'QA')) {
8582
stage('Delivery') {
86-
node {
83+
node("C++") {
84+
unstash 'el7-rpms'
85+
unstash 'el8-rpms'
8786
sh 'setup_centreon_build.sh'
8887
sh "./centreon-build/jobs/broker/${serie}/mon-broker-delivery.sh"
8988
}

0 commit comments

Comments
 (0)