diff --git a/Jenkinsfile b/Jenkinsfile index 3078df7667a4abe4e34205fe2be92e623ec06abc..3b072197e463b80d07477b585c118db034f5ea80 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,7 +6,7 @@ pipeline { } environment { - BLUE_OCEAN_URL = "https://jenkins.infra.ozg-cloud.systems/job/info-manager/job/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/" + JENKINS_URL = "https://jenkins.infra.ozg-cloud.systems/job/codeSH_info-manager/job/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/" RELEASE_REGEX = /\d+.\d+.\d+/ SNAPSHOT_REGEX = /\d+.\d+.\d+-SNAPSHOT/ FAILED_STAGE = "" @@ -49,7 +49,7 @@ pipeline { when { not { anyOf { - branch 'master' + branch 'main' branch 'release' } } @@ -82,7 +82,7 @@ pipeline { } stage('Sonar Checks') { when { - branch 'master' + branch 'main' } steps { script { @@ -138,7 +138,7 @@ pipeline { tagAndPushDockerImage(IMAGE_TAG) - if (env.BRANCH_NAME == 'master') { + if (isMainBranch()) { tagAndPushDockerImage('snapshot-latest') } @@ -170,7 +170,7 @@ pipeline { stage('Trigger Dev rollout') { when { - branch 'master' + branch 'main' } steps { script { @@ -227,7 +227,7 @@ pipeline { } failure { script { - if (env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'release') { + if (isMainBranch() || env.BRANCH_NAME == 'release') { sendFailureMessage() } } @@ -361,11 +361,11 @@ Boolean hasInfoManagerValuesFileChanged(String environment) { Void sendFailureMessage() { def room = '' def data = """{"msgtype":"m.text", \ - "body":"InfoManager: Build Failed. Stage: ${FAILED_STAGE} Build-ID: ${env.BUILD_NUMBER} Link: ${BLUE_OCEAN_URL}", \ + "body":"InfoManager: Build Failed. Stage: ${FAILED_STAGE} Build-ID: ${env.BUILD_NUMBER} Link: ${JENKINS_URL}", \ "format": "org.matrix.custom.html", \ - "formatted_body":"InfoManager: Build Failed. Stage: ${FAILED_STAGE} Build-ID: <a href='${BLUE_OCEAN_URL}'>${env.BUILD_NUMBER}</a>"}""" + "formatted_body":"InfoManager: Build Failed. Stage: ${FAILED_STAGE} Build-ID: <a href='${JENKINS_URL}'>${env.BUILD_NUMBER}</a>"}""" - if (env.BRANCH_NAME == 'master') { + if (isMainBranch()) { room = "!iQPAvQIiRwRpNOszjw:matrix.ozg-sh.de" } else if (env.BRANCH_NAME == 'release') { @@ -386,4 +386,8 @@ void updateInfoManagerInterfaceDependencyVersion(String snapshotVersion) { infoManagerServerPom.properties['info-manager-interface.version'] = snapshotVersion writeMavenPom model: infoManagerServerPom, file: 'info-manager-server/pom.xml' } -} \ No newline at end of file +} + +Boolean isMainBranch() { + return env.BRANCH_NAME == 'main' +}