Commit 01f00784 authored by Kevin Duret's avatar Kevin Duret
Browse files

fix(ci): remove unit test stage (#45)

parent d9703a49
/*
** Variables.
*/
properties([buildDiscarder(logRotator(numToKeepStr: '50'))])
def serie = '20.10'
def maintenanceBranch = "${serie}.x"
def qaBranch = "dev-${serie}.x"
if (env.BRANCH_NAME.startsWith('release-')) {
env.BUILD = 'RELEASE'
} else if ((env.BRANCH_NAME == 'master') || (env.BRANCH_NAME == maintenanceBranch)) {
} else if ((env.BRANCH_NAME == env.REF_BRANCH) || (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 featureFiles = []
def buildBranch = env.BRANCH_NAME
if (env.CHANGE_BRANCH) {
buildBranch = env.CHANGE_BRANCH
}
/*
** Functions
*/
def isStableBuild() {
return ((env.BUILD == 'REFERENCE') || (env.BUILD == 'QA'))
}
def checkoutCentreonBuild(buildBranch) {
def getCentreonBuildGitConfiguration = { branchName -> [
$class: 'GitSCM',
branches: [[name: "refs/heads/${branchName}"]],
doGenerateSubmoduleConfigurations: false,
userRemoteConfigs: [[
$class: 'UserRemoteConfig',
url: "ssh://git@github.com/centreon/centreon-build.git"
]]
]}
dir('centreon-build') {
try {
checkout(getCentreonBuildGitConfiguration(buildBranch))
} catch(e) {
echo "branch '${buildBranch}' does not exist in centreon-build, then fallback to master"
checkout(getCentreonBuildGitConfiguration('master'))
}
}
}
/*
** Pipeline code.
*/
stage('Source') {
stage('Deliver sources') {
node {
sh 'setup_centreon_build.sh'
checkoutCentreonBuild(buildBranch)
env.WIDGET = 'tactical-overview'
dir("centreon-widget-${env.WIDGET}") {
checkout scm
......@@ -41,28 +75,48 @@ stage('Source') {
}
try {
stage('Package') {
parallel 'centos7': {
stage('RPMs packaging // Sonar analysis') {
parallel 'Sonar analysis': {
node {
sh 'setup_centreon_build.sh'
checkoutCentreonBuild(buildBranch)
withSonarQubeEnv('SonarQubeDev') {
sh "./centreon-build/jobs/widgets/${serie}/widget-analysis.sh"
}
def qualityGate = waitForQualityGate()
if (qualityGate.status != 'OK') {
currentBuild.result = 'FAIL'
}
}
},
'RPM packaging centos7': {
node {
checkoutCentreonBuild(buildBranch)
sh "./centreon-build/jobs/widgets/${serie}/widget-package.sh centos7"
archiveArtifacts artifacts: 'rpms-centos7.tar.gz'
stash name: "rpms-centos7", includes: 'output/noarch/*.rpm'
sh 'rm -rf output'
}
},
'centos8': {
'RPM packaging centos8': {
node {
sh 'setup_centreon_build.sh'
checkoutCentreonBuild(buildBranch)
sh "./centreon-build/jobs/widgets/${serie}/widget-package.sh centos8"
archiveArtifacts artifacts: 'rpms-centos8.tar.gz'
stash name: "rpms-centos8", includes: 'output/noarch/*.rpm'
sh 'rm -rf output'
}
}
if ((currentBuild.result ?: 'SUCCESS') != 'SUCCESS') {
error('Package stage failure.');
error('Unit tests stage failure.');
}
}
if ((env.BUILD == 'RELEASE') || (env.BUILD == 'REFERENCE')) {
if ((env.BUILD == 'RELEASE') || (env.BUILD == 'QA') || (env.BUILD == 'CI')) {
stage('Delivery') {
node {
sh 'setup_centreon_build.sh'
checkoutCentreonBuild(buildBranch)
unstash 'rpms-centos8'
unstash 'rpms-centos7'
sh "./centreon-build/jobs/widgets/${serie}/widget-delivery.sh"
}
if ((currentBuild.result ?: 'SUCCESS') != 'SUCCESS') {
......
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