diff --git a/Jenkinsfile b/Jenkinsfile index 76758a27dc4b623653fae6f27a92a613e1fea9a6..941d21cbbec9c613a80021364a4f3841b3477f9c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,7 +31,7 @@ pipeline { } environment { - BLUE_OCEAN_URL = "https://jenkins.infra.ozg-cloud.systems/job/ozgcloud-common/job/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/" + JENKINS_URL = "https://jenkins.infra.ozg-cloud.systems/job/codeSH_common-lib/job/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/" RELEASE_REGEX = /\d+.\d+.\d+/ SNAPSHOT_REGEX = /\d+.\d+.\d+-SNAPSHOT/ } @@ -76,7 +76,7 @@ pipeline { when { not { anyOf { - branch 'master' + branch 'main' branch 'release' } } @@ -121,7 +121,7 @@ pipeline { script { dir('ozgcloud-common-lib') { try { - if (env.BRANCH_NAME == 'master') { + if (isMainBranch()) { withSonarQubeEnv('sonarqube-ozg-sh'){ sh 'mvn sonar:sonar' } @@ -151,7 +151,7 @@ pipeline { post { failure { script { - if (env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'release') { + if (isMainBranch() || env.BRANCH_NAME == 'release') { sendFailureMessage() } } @@ -179,7 +179,7 @@ Void sendFailureMessage() { "format": "org.matrix.custom.html", \ "formatted_body":"ozgcloud-common: Build Failed. Stage: ${FAILED_STAGE} Build-ID: <a href='${BLUE_OCEAN_URL}'>${env.BUILD_NUMBER}</a>"}""" - if (env.BRANCH_NAME == 'master') { + if (isMainBranch()) { room = "!GjqhmouBtnDbwUkAjx:matrix.ozg-sh.de" } else if (env.BRANCH_NAME == 'release') { @@ -199,4 +199,8 @@ String getPomVersion(String pomFile){ def pom = readMavenPom file: pomFile return pom.version +} + +Boolean isMainBranch() { + return env.BRANCH_NAME == 'main' } \ No newline at end of file