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

OZG-7324 adjust JenkinsFile

parent 6d21272f
Branches
Tags
No related merge requests found
......@@ -8,7 +8,7 @@ pipeline {
}
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+/
SNAPSHOT_REGEX = /\d+.\d+.\d+-SNAPSHOT/
}
......@@ -43,7 +43,7 @@ pipeline {
when {
not {
anyOf {
branch 'master'
branch 'main'
branch 'release'
}
}
......@@ -85,7 +85,7 @@ pipeline {
post {
failure {
script {
if (env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'release') {
if (isMainBranch() || env.BRANCH_NAME == 'release') {
sendFailureMessage()
}
}
......@@ -96,11 +96,11 @@ pipeline {
Void sendFailureMessage() {
def room = ''
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", \
"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"
}
else if (env.BRANCH_NAME == 'release') {
......@@ -120,4 +120,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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment