From 1ddbe6c2f80b108999607a686d535a390e314c97 Mon Sep 17 00:00:00 2001
From: Martin <git@mail.de>
Date: Thu, 19 Dec 2024 11:33:34 +0100
Subject: [PATCH] OZG-7324 adjust JenkinsFile

---
 Jenkinsfile | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 76758a2..941d21c 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -31,7 +31,7 @@ pipeline {
     }
 
     environment {
-        BLUE_OCEAN_URL = "https://jenkins.infra.ozg-cloud.systems/job/ozgcloud-common/job/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/"
+        JENKINS_URL = "https://jenkins.infra.ozg-cloud.systems/job/codeSH_common-lib/job/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/"
         RELEASE_REGEX = /\d+.\d+.\d+/
         SNAPSHOT_REGEX = /\d+.\d+.\d+-SNAPSHOT/
     }
@@ -76,7 +76,7 @@ pipeline {
           when {
             not {
                 anyOf {
-                    branch 'master'
+                    branch 'main'
                     branch 'release'
                 }
             }
@@ -121,7 +121,7 @@ pipeline {
 	                script {
 	              	    dir('ozgcloud-common-lib') {
 	                    	try {
-	                            if (env.BRANCH_NAME == 'master') {
+	                            if (isMainBranch()) {
 	                                withSonarQubeEnv('sonarqube-ozg-sh'){
     					    			sh 'mvn sonar:sonar'	                                
 	                                }
@@ -151,7 +151,7 @@ pipeline {
     post {
         failure {
             script {
-                if (env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'release') {
+                if (isMainBranch() || env.BRANCH_NAME == 'release') {
                     sendFailureMessage()
                 }
             }
@@ -179,7 +179,7 @@ Void sendFailureMessage() {
                     "format": "org.matrix.custom.html", \
                     "formatted_body":"ozgcloud-common: Build Failed. Stage: ${FAILED_STAGE} Build-ID: <a href='${BLUE_OCEAN_URL}'>${env.BUILD_NUMBER}</a>"}"""
        
-    if (env.BRANCH_NAME == 'master') {
+    if (isMainBranch()) {
         room = "!GjqhmouBtnDbwUkAjx:matrix.ozg-sh.de"
     }
     else if (env.BRANCH_NAME == 'release') {
@@ -199,4 +199,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
-- 
GitLab