diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000000000000000000000000000000000000..b9544b13e0c6a0351f21a1d9191a623650ccea8e --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,50 @@ +def FAILED_STAGE + +pipeline { + agent { + node { + label 'jenkins-build-agent' + } + } + + environment { + BLUE_OCEAN_URL = "https://jenkins.ozg-sh.de/job/kop-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 + + if(env.BRANCH_NAME == 'release'){ + if ( !(rootVersion ==~ RELEASE_REGEX)) { + error("Keine Release Version für Branch ${env.BRANCH_NAME}.") + } + } else { + if ( !(rootVersion ==~ SNAPSHOT_REGEX)) { + error("Keine Snapshot Version für Branch ${env.BRANCH_NAME}.") + } + } + } + } + } //stage check version + stage('Build') { + steps { + script { + FAILED_STAGE=env.STAGE_NAME + } + } + } //stage build + } //stages +} //pipeline