Skip to content
Snippets Groups Projects
Commit 3555fbc5 authored by Martin's avatar Martin
Browse files

OZG-7324 adjust JenkinsFile

parent f49927e3
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ pipeline { ...@@ -6,7 +6,7 @@ pipeline {
} }
environment { 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+/ RELEASE_REGEX = /\d+.\d+.\d+/
SNAPSHOT_REGEX = /\d+.\d+.\d+-SNAPSHOT/ SNAPSHOT_REGEX = /\d+.\d+.\d+-SNAPSHOT/
FAILED_STAGE = "" FAILED_STAGE = ""
...@@ -52,7 +52,7 @@ pipeline { ...@@ -52,7 +52,7 @@ pipeline {
when { when {
not { not {
anyOf { anyOf {
branch 'master' branch 'main'
branch 'release' branch 'release'
} }
} }
...@@ -110,7 +110,7 @@ pipeline { ...@@ -110,7 +110,7 @@ pipeline {
stage('Sonar Checks') { stage('Sonar Checks') {
when { when {
branch 'master' branch 'main'
} }
steps { steps {
script { script {
...@@ -136,7 +136,7 @@ pipeline { ...@@ -136,7 +136,7 @@ pipeline {
} }
failure { failure {
script { script {
if (env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'release') { if (isMainBranch() || env.BRANCH_NAME == 'release') {
sendFailureMessage() sendFailureMessage()
} }
} }
...@@ -147,11 +147,11 @@ pipeline { ...@@ -147,11 +147,11 @@ pipeline {
Void sendFailureMessage() { Void sendFailureMessage() {
def room = '' def room = ''
def data = """{"msgtype":"m.text", 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", "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" room = "!GjqhmouBtnDbwUkAjx:matrix.ozg-sh.de"
} }
else if (env.BRANCH_NAME == 'release') { else if (env.BRANCH_NAME == 'release') {
...@@ -177,3 +177,7 @@ String getParentPomVersion(String filePath) { ...@@ -177,3 +177,7 @@ String getParentPomVersion(String filePath) {
def pom = readMavenPom file: filePath def pom = readMavenPom file: filePath
return pom.parent.version return pom.parent.version
} }
Boolean isMainBranch() {
return env.BRANCH_NAME == 'main'
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment