Skip to content
Snippets Groups Projects
Commit 612b2d18 authored by Martin's avatar Martin
Browse files

OZG-7324 adjust JenkinsFile

parent 6d21272f
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ pipeline { ...@@ -8,7 +8,7 @@ pipeline {
} }
environment { environment {
BLUE_OCEAN_URL = "https://jenkins.ozg-sh.de/job/api-lib/job/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/" JENKINS_URL = "https://jenkins.ozg-sh.de/job/codeSH_api-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/
} }
...@@ -43,7 +43,7 @@ pipeline { ...@@ -43,7 +43,7 @@ pipeline {
when { when {
not { not {
anyOf { anyOf {
branch 'master' branch 'main'
branch 'release' branch 'release'
} }
} }
...@@ -85,7 +85,7 @@ pipeline { ...@@ -85,7 +85,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()
} }
} }
...@@ -96,11 +96,11 @@ pipeline { ...@@ -96,11 +96,11 @@ pipeline {
Void sendFailureMessage() { Void sendFailureMessage() {
def room = '' def room = ''
def data = """{"msgtype":"m.text", \ def data = """{"msgtype":"m.text", \
"body":"api-lib: Build Failed. Stage: ${FAILED_STAGE} Build-ID: ${env.BUILD_NUMBER} Link: ${BLUE_OCEAN_URL}", \ "body":"api-lib: Build Failed. Stage: ${FAILED_STAGE} Build-ID: ${env.BUILD_NUMBER} Link: ${JENKINS_URL}", \
"format": "org.matrix.custom.html", \ "format": "org.matrix.custom.html", \
"formatted_body":"api-lib: Build Failed. Stage: ${FAILED_STAGE} Build-ID: <a href='${BLUE_OCEAN_URL}'>${env.BUILD_NUMBER}</a>"}""" "formatted_body":"api-lib: Build Failed. Stage: ${FAILED_STAGE} Build-ID: <a href='${JENKINS_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') {
...@@ -120,4 +120,8 @@ String getPomVersion(String pomFile){ ...@@ -120,4 +120,8 @@ String getPomVersion(String pomFile){
def pom = readMavenPom file: pomFile def pom = readMavenPom file: 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