diff --git a/Jenkinsfile b/Jenkinsfile index 23b0ac4285e3a1ce5f5a7a73b611935193a937c1..d8395ba0f016e884864a9b1d45e2b06b82b33325 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,7 +6,7 @@ pipeline { } environment { - BLUE_OCEAN_URL = "https://jenkins.infra.ozg-cloud.systems/job/ozgcloud-document-manager/job/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/" + JENKINS_URL = "https://jenkins.infra.ozg-cloud.systems/job/codeSH_document-manager/job/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/" RELEASE_REGEX = /\d+.\d+.\d+/ SNAPSHOT_REGEX = /\d+.\d+.\d+-SNAPSHOT/ FAILED_STAGE = "" @@ -52,7 +52,7 @@ pipeline { when { not { anyOf { - branch 'master' + branch 'main' branch 'release' } } @@ -110,7 +110,7 @@ pipeline { stage('Sonar Checks') { when { - branch 'master' + branch 'main' } steps { script { @@ -136,7 +136,7 @@ pipeline { } failure { script { - if (env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'release') { + if (isMainBranch() || env.BRANCH_NAME == 'release') { sendFailureMessage() } } @@ -147,11 +147,11 @@ pipeline { Void sendFailureMessage() { def room = '' def data = """{"msgtype":"m.text", - "body":"Document-Manager: Build Failed. Stage: ${FAILED_STAGE} Build-ID: ${env.BUILD_NUMBER} Link: ${BLUE_OCEAN_URL}", + "body":"Document-Manager: Build Failed. Stage: ${FAILED_STAGE} Build-ID: ${env.BUILD_NUMBER} Link: ${JENKINS_URL}", "format": "org.matrix.custom.html", - "formatted_body":"<h3>Document-Manager: Build Failed.</h3><b>Stage:</b> ${FAILED_STAGE}<br><b>Build-ID:</b> <a href='${BLUE_OCEAN_URL}'>${env.BUILD_NUMBER}</a>"}""" + "formatted_body":"<h3>Document-Manager: Build Failed.</h3><b>Stage:</b> ${FAILED_STAGE}<br><b>Build-ID:</b> <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') { @@ -176,4 +176,8 @@ String getPomVersion(String pomFile){ String getParentPomVersion(String filePath) { def pom = readMavenPom file: filePath return pom.parent.version -} \ No newline at end of file +} + +Boolean isMainBranch() { + return env.BRANCH_NAME == 'main' +}