Skip to content
This repository was archived by the owner on Nov 16, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 35 additions & 25 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ def serie = '20.10'
def maintenanceBranch = "${serie}.x"
env.PROJECT='centreon-awie'

def checkoutCentreonBuild() {
dir('centreon-build') {
checkout resolveScm(source: [$class: 'GitSCMSource',
remote: 'https://github.com/centreon/centreon-build.git',
credentialsId: 'technique-ci',
traits: [[$class: 'jenkins.plugins.git.traits.BranchDiscoveryTrait']]],
targets: [env.BRANCH_NAME, 'master'])
}
}

if (env.BRANCH_NAME.startsWith('release-')) {
env.BUILD = 'RELEASE'
} else if ((env.BRANCH_NAME == 'master') || (env.BRANCH_NAME == maintenanceBranch)) {
Expand All @@ -21,7 +31,7 @@ if (env.BRANCH_NAME.startsWith('release-')) {
*/
stage('Source') {
node {
sh 'setup_centreon_build.sh'
checkoutCentreonBuild()
dir('centreon-awie') {
checkout scm
}
Expand All @@ -43,7 +53,7 @@ try {
stage('Unit tests // RPM Packaging // Sonar analysis') {
parallel 'unit tests centos7': {
node {
sh 'setup_centreon_build.sh'
checkoutCentreonBuild()
/*
sh "./centreon-build/jobs/awie/${serie}/mon-awie-unittest.sh centos7"
junit 'ut.xml'
Expand Down Expand Up @@ -77,7 +87,7 @@ try {
},
'Packaging centos7': {
node {
sh 'setup_centreon_build.sh'
checkoutCentreonBuild()
sh "./centreon-build/jobs/awie/${serie}/mon-awie-package.sh centos7"
archiveArtifacts artifacts: 'rpms-centos7.tar.gz'
stash name: "rpms-centos7", includes: 'output/noarch/*.rpm'
Expand All @@ -86,7 +96,7 @@ try {
},
'Packaging alma8': {
node {
sh 'setup_centreon_build.sh'
checkoutCentreonBuild()
sh "./centreon-build/jobs/awie/${serie}/mon-awie-package.sh alma8"
archiveArtifacts artifacts: 'rpms-alma8.tar.gz'
stash name: "rpms-alma8", includes: 'output/noarch/*.rpm'
Expand All @@ -103,7 +113,7 @@ try {
node {
unstash 'rpms-alma8'
unstash 'rpms-centos7'
sh 'setup_centreon_build.sh'
checkoutCentreonBuild()
sh "./centreon-build/jobs/awie/${serie}/mon-awie-delivery.sh"
}
}
Expand All @@ -115,16 +125,16 @@ try {
stage('Docker creation') {
parallel 'Docker centos7': {
node {
sh 'setup_centreon_build.sh'
checkoutCentreonBuild()
sh "./centreon-build/jobs/awie/${serie}/mon-awie-bundle.sh centos7"
}
},
'alma8': {
node {
checkoutCentreonBuild()
sh "./centreon-build/jobs/awie/${serie}/mon-awie-bundle.sh alma8"
}
}
// 'centos8': {
// node {
// sh 'setup_centreon_build.sh'
// sh "./centreon-build/jobs/awie/${serie}/mon-awie-bundle.sh centos8"
// }
// }
if ((currentBuild.result ?: 'SUCCESS') != 'SUCCESS') {
error('Bundle stage failure.');
}
Expand All @@ -133,24 +143,24 @@ try {
stage('Acceptance tests') {
parallel 'centos7': {
node {
sh 'setup_centreon_build.sh'
checkoutCentreonBuild()
sh "./centreon-build/jobs/awie/${serie}/mon-awie-acceptance.sh centos7"
junit 'xunit-reports/**/*.xml'
if (currentBuild.result == 'UNSTABLE')
currentBuild.result = 'FAILURE'
archiveArtifacts allowEmptyArchive: true, artifacts: 'acceptance-logs/*.txt, acceptance-logs/*.png'
}
},
'alma8': {
node {
checkoutCentreonBuild()
sh "./centreon-build/jobs/awie/${serie}/mon-awie-acceptance.sh alma8"
junit 'xunit-reports/**/*.xml'
if (currentBuild.result == 'UNSTABLE')
currentBuild.result = 'FAILURE'
archiveArtifacts allowEmptyArchive: true, artifacts: 'acceptance-logs/*.txt, acceptance-logs/*.png'
}
}
// 'centos8': {
// node {
// sh 'setup_centreon_build.sh'
// sh "./centreon-build/jobs/awie/${serie}/mon-awie-acceptance.sh centos8"
// junit 'xunit-reports/**/*.xml'
// if (currentBuild.result == 'UNSTABLE')
// currentBuild.result = 'FAILURE'
// archiveArtifacts allowEmptyArchive: true, artifacts: 'acceptance-logs/*.txt, acceptance-logs/*.png'
// }
// }
if ((currentBuild.result ?: 'SUCCESS') != 'SUCCESS') {
error('Acceptance tests stage failure.');
}
Expand All @@ -159,9 +169,9 @@ try {
if ((env.BUILD == 'RELEASE') || (env.BUILD == 'REFERENCE')) {
stage('Delivery') {
node {
sh 'setup_centreon_build.sh'
checkoutCentreonBuild()
unstash 'rpms-centos7'
// unstash 'rpms-centos8'
unstash 'rpms-alma8'
sh "./centreon-build/jobs/awie/${serie}/mon-awie-delivery.sh"
}
if ((currentBuild.result ?: 'SUCCESS') != 'SUCCESS') {
Expand Down