Commit ce0bfb95 authored by Zakaria Guennoune's avatar Zakaria Guennoune Committed by Zakaria Guennoune
Browse files

fix(ci) Using right sonarqube instance to analyse code (#30)

* fixing sonarqube server

* rename unit test stage to sonar stage

* refacotring centreon build call
parent 989124a5
/*
** Variables.
*/
<<<<<<< HEAD
def serie = '21.04'
=======
properties([buildDiscarder(logRotator(numToKeepStr: '10'))])
def serie = '21.10'
>>>>>>> 192b7a4 (fix(ci) Using right sonarqube instance to analyse code (#30))
def maintenanceBranch = "${serie}.x"
if (env.BRANCH_NAME.startsWith('release-')) {
env.BUILD = 'RELEASE'
......@@ -11,15 +16,49 @@ if (env.BRANCH_NAME.startsWith('release-')) {
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 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') {
node {
sh 'setup_centreon_build.sh'
dir('centreon-connector') {
checkout scm
}
checkoutCentreonBuild(buildBranch)
sh "./centreon-build/jobs/connector/${serie}/mon-connector-source.sh"
source = readProperties file: 'source.properties'
publishHTML([
......@@ -36,7 +75,7 @@ stage('Source') {
}
try {
stage('Unit tests') {
stage('Sonar analysis') {
parallel 'centos7': {
node {
sh 'setup_centreon_build.sh'
......@@ -52,7 +91,7 @@ try {
])
*/
if ((env.BUILD == 'RELEASE') || (env.BUILD == 'REFERENCE')) {
withSonarQubeEnv('SonarQube') {
withSonarQubeEnv('SonarQubeDev') {
sh "./centreon-build/jobs/connector/${serie}/mon-connector-analysis.sh"
}
}
......
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