diff --git a/Jenkinsfile b/Jenkinsfile index 9a0e68a05668bba7a72232da30d8feb83d6af15e..7829463eb942043a879c2c9835c7f95cb621a56c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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