Skip to content
Snippets Groups Projects
Commit 1ddbe6c2 authored by Martin's avatar Martin
Browse files

OZG-7324 adjust JenkinsFile

parent 25786e3f
Branches
Tags
No related merge requests found
...@@ -31,7 +31,7 @@ pipeline { ...@@ -31,7 +31,7 @@ pipeline {
} }
environment { 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+/ RELEASE_REGEX = /\d+.\d+.\d+/
SNAPSHOT_REGEX = /\d+.\d+.\d+-SNAPSHOT/ SNAPSHOT_REGEX = /\d+.\d+.\d+-SNAPSHOT/
} }
...@@ -76,7 +76,7 @@ pipeline { ...@@ -76,7 +76,7 @@ pipeline {
when { when {
not { not {
anyOf { anyOf {
branch 'master' branch 'main'
branch 'release' branch 'release'
} }
} }
...@@ -121,7 +121,7 @@ pipeline { ...@@ -121,7 +121,7 @@ pipeline {
script { script {
dir('ozgcloud-common-lib') { dir('ozgcloud-common-lib') {
try { try {
if (env.BRANCH_NAME == 'master') { if (isMainBranch()) {
withSonarQubeEnv('sonarqube-ozg-sh'){ withSonarQubeEnv('sonarqube-ozg-sh'){
sh 'mvn sonar:sonar' sh 'mvn sonar:sonar'
} }
...@@ -151,7 +151,7 @@ pipeline { ...@@ -151,7 +151,7 @@ pipeline {
post { post {
failure { failure {
script { script {
if (env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'release') { if (isMainBranch() || env.BRANCH_NAME == 'release') {
sendFailureMessage() sendFailureMessage()
} }
} }
...@@ -179,7 +179,7 @@ Void sendFailureMessage() { ...@@ -179,7 +179,7 @@ Void sendFailureMessage() {
"format": "org.matrix.custom.html", \ "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>"}""" "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" room = "!GjqhmouBtnDbwUkAjx:matrix.ozg-sh.de"
} }
else if (env.BRANCH_NAME == 'release') { else if (env.BRANCH_NAME == 'release') {
...@@ -200,3 +200,7 @@ String getPomVersion(String pomFile){ ...@@ -200,3 +200,7 @@ String getPomVersion(String pomFile){
return pom.version return pom.version
} }
Boolean isMainBranch() {
return env.BRANCH_NAME == 'main'
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment