Skip to content
Snippets Groups Projects
Select Git revision
  • a293c6bad932a5b8ce35767c6738ed525c8afdb8
  • main default protected
  • release
  • create-gitlab-pipeline
  • OZG-7426-Dateitransfer-Eingang
  • OZG-7324-license-header-update
  • 4.15.0
  • 4.14.0
  • 4.13.0
  • 4.12.0
  • 4.11.0
  • 4.10.0
  • 4.9.0
  • 4.8.0
  • 4.7.0
  • 4.6.0
  • 4.5.0
  • 4.4.0
  • 4.3.2
  • 4.3.1
  • 4.3.0
  • 4.2.0
  • 4.1.0
  • 4.0.1
  • 3.0.1
  • 3.0.0
26 results

Jenkinsfile

Blame
  • Jenkinsfile 6.04 KiB
    def FAILED_STAGE
    
    pipeline {
        agent {
           node {
               label 'ozgcloud-jenkins-build-agent-jdk21'
            }
        }
    
        environment {
            BLUE_OCEAN_URL = "https://jenkins.infra.ozg-cloud.systems/job/ozgcloud-common/job/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/"
            RELEASE_REGEX = /\d+.\d+.\d+/
            SNAPSHOT_REGEX = /\d+.\d+.\d+-SNAPSHOT/
        }
    
        options {
            timeout(time: 1, unit: 'HOURS')
            disableConcurrentBuilds()
            buildDiscarder(logRotator(numToKeepStr: '5'))
        }
    
        stages {
    /*        stage('Check Version') {
                steps {
                    script {
                        FAILED_STAGE = env.STAGE_NAME
                        def rootPom = readMavenPom file: 'pom.xml'
                        def rootVersion = rootPom.version
                        
                        def dependenciesPom = readMavenPom file: 'ozgcloud-common-dependencies/pom.xml'
                        def dependenciesVersion = dependenciesPom.parent.version
                        
                        def parentPom = readMavenPom file: 'ozgcloud-common-parent/pom.xml'
                        def parentVersion = parentPom.version
    
                        if(env.BRANCH_NAME == 'release'){
                            if ( !(rootVersion ==~ RELEASE_REGEX) || !(dependenciesVersion ==~ RELEASE_REGEX) || !(parentVersion ==~ RELEASE_REGEX)) {
                                error("Keine Release Version für Branch ${env.BRANCH_NAME}.")
                            }
                        } else {
                            if ( !(rootVersion ==~ SNAPSHOT_REGEX) || !(dependenciesVersion ==~ SNAPSHOT_REGEX) || !(parentVersion ==~ SNAPSHOT_REGEX)) {
                                error("Keine Snapshot Version für Branch ${env.BRANCH_NAME}.")
                            }
                        }
    
                        if( !(rootVersion == dependenciesVersion && rootVersion == parentVersion)){
                            error("Versionen sind nicht identisch")                        
                        }                    
                    }
                }
            }*/
           stage('Set Version') {
              when {
                not {
                    anyOf {
                        branch 'master'
                        branch 'release'
                    }
                }
              }
              steps {
                    script {
                        FAILED_STAGE=env.STAGE_NAME
                        JAR_TAG = getPomVersion('pom.xml').replace("SNAPSHOT", "${env.BRANCH_NAME}-SNAPSHOT")
                    }
                    configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) {
                        sh "mvn -s $MAVEN_SETTINGS versions:set -DnewVersion=${JAR_TAG} -DprocessAllModules=true"
                        
                    }
              }