diff --git a/Jenkinsfile b/Jenkinsfile index c9a4619..d7e35e8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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)) { @@ -21,7 +31,7 @@ if (env.BRANCH_NAME.startsWith('release-')) { */ stage('Source') { node { - sh 'setup_centreon_build.sh' + checkoutCentreonBuild() dir('centreon-awie') { checkout scm } @@ -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' @@ -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' @@ -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' @@ -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" } } @@ -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.'); } @@ -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.'); } @@ -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') {