Commit 1b37828e authored by Zakaria Guennoune's avatar Zakaria Guennoune Committed by Zakaria Guennoune
Browse files

enh(ci): New packaging workflow (#33)

* new packaging worfklow

* fixing checkout of centreon build
Conflicts:
	Jenkinsfile
parent 65cbd7dd
......@@ -9,21 +9,18 @@ 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'
}
def buildBranch = env.BRANCH_NAME
if (env.CHANGE_BRANCH) {
buildBranch = env.CHANGE_BRANCH
}
/*
** Functions
*/
def isStableBuild() {
return ((env.BUILD == 'RELEASE') || (env.BUILD == 'REFERENCE'))
def buildBranch = env.BRANCH_NAME
if (env.CHANGE_BRANCH) {
buildBranch = env.CHANGE_BRANCH
}
def checkoutCentreonBuild(buildBranch) {
......@@ -51,7 +48,7 @@ def checkoutCentreonBuild(buildBranch) {
** Pipeline code.
*/
stage('Source') {
node {
node("C++") {
dir('centreon-connector') {
checkout scm
}
......@@ -72,56 +69,43 @@ stage('Source') {
}
try {
stage('Sonar analysis') {
node {
sh 'setup_centreon_build.sh'
/* unittest.sh does not exist currently. ADD the missing script before restoring this part
sh "./centreon-build/jobs/connector/${serie}/mon-connector-unittest.sh centos7"
step([
$class: 'XUnitBuilder',
thresholds: [
[$class: 'FailedThreshold', failureThreshold: '0'],
[$class: 'SkippedThreshold', failureThreshold: '0']
],
tools: [[$class: 'GoogleTestType', pattern: 'ut.xml']]
])
*/
withSonarQubeEnv('SonarQubeDev') {
sh "./centreon-build/jobs/connector/${serie}/mon-connector-analysis.sh"
}
}
timeout(time: 10, unit: 'MINUTES') {
def qualityGate = waitForQualityGate()
if (qualityGate.status != 'OK') {
currentBuild.result = 'FAIL'
}
}
if ((currentBuild.result ?: 'SUCCESS') != 'SUCCESS') {
error("Quality gate failure: ${qualityGate.status}.");
}
}
stage('Package') {
parallel 'centos7': {
node {
stage('Packaging // Sonar analysis // Quality Gate') {
parallel 'packaging centos7': {
node("C++") {
sh 'setup_centreon_build.sh'
sh "./centreon-build/jobs/connector/${serie}/mon-connector-package.sh centos7"
stash name: 'el7-rpms', includes: "output/x86_64/*.rpm"
archiveArtifacts artifacts: "output/x86_64/*.rpm"
}
},
'centos8': {
node {
'packaging centos8': {
node("C++") {
sh 'setup_centreon_build.sh'
sh "./centreon-build/jobs/connector/${serie}/mon-connector-package.sh centos8"
stash name: 'el8-rpms', includes: "output/x86_64/*.rpm"
archiveArtifacts artifacts: "output/x86_64/*.rpm"
}
},
'Sonar analysis and Quality Gate': {
node("C++") {
sh 'setup_centreon_build.sh'
withSonarQubeEnv('SonarQubeDev') {
sh "./centreon-build/jobs/connector/${serie}/mon-connector-analysis.sh"
}
}
}
timeout(time: 10, unit: 'MINUTES') {
def qualityGate = waitForQualityGate()
if (qualityGate.status != 'OK') {
currentBuild.result = 'FAIL'
}
}
if ((currentBuild.result ?: 'SUCCESS') != 'SUCCESS') {
error('Package stage failure.');
error('Packaging // Sonar analysis // Quality Gate failure');
}
}
if ((env.BUILD == 'RELEASE') || (env.BUILD == 'REFERENCE')) {
if ((env.BUILD == 'RELEASE') || (env.BUILD == 'QA')) {
stage('Delivery') {
node("C++") {
unstash 'el7-rpms'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment