diff --git a/Jenkinsfile b/Jenkinsfile index 91e07a58f5e89cf1ff650ccc791b44565a426430..e8a39591a712e59d8d9e77f9b63174ab2eb381ec 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,6 +9,8 @@ pipeline { environment { BLUE_OCEAN_URL = "https://jenkins.ozg-sh.de/blue/organizations/jenkins/intelliform-adapter/detail/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/pipeline" + RELEASE_REGEX = /\d+.\d+.\d+/ + SNAPSHOT_REGEX = /\d+.\d+.\d+-SNAPSHOT/ } options { @@ -18,6 +20,42 @@ pipeline { } stages { + stage('Check Version') { + steps { + script { + FAILED_STAGE = env.STAGE_NAME + def rootPom = readMavenPom file: 'pom.xml' + def rootVersion = rootPom.version + def plutoVersion = rootPom.properties.pluto.version + + def commonPom = readMavenPom file: 'common/pom.xml' + def commonVersion = commonPom.parent.version + + def routerPom = readMavenPom file: 'router/pom.xml' + def routerVersion = routerPom.parent.version + + def ifAdapterPom = readMavenPom file: 'intelliform-adapter/pom.xml' + def ifAdapterVersion = ifAdapterPom.parent.version + + def fsAdapterPom = readMavenPom file: 'formsolutions-adapter/pom.xml' + def fsAdapterVersion = fsAdapterPom.parent.version + + if(env.BRANCH_NAME == 'release'){ + if ( !(rootVersion ==~ RELEASE_REGEX) || !(plutoVersion ==~ RELEASE_REGEX) || !(commonVersion ==~ RELEASE_REGEX) || !(routerVersion ==~ RELEASE_REGEX) || !(ifAdapterVersion ==~ RELEASE_REGEX) || !(fsAdapterVersion ==~ RELEASE_REGEX)) { + error("Keine Release Version für Branch ${env.BRANCH_NAME}.") + } + } else { + if ( !(rootVersion ==~ SNAPSHOT_REGEX) || !(plutoVersion ==~ SNAPSHOT_REGEX) || !(commonVersion ==~ SNAPSHOT_REGEX) || !(routerVersion ==~ SNAPSHOT_REGEX) || !(ifAdapterVersion ==~ SNAPSHOT_REGEX) || !(fsAdapterVersion ==~ SNAPSHOT_REGEX)) { + error("Keine Snapshot Version für Branch ${env.BRANCH_NAME}.") + } + } + + if( !(rootVersion == commonVersion && rootVersion == routerVersion && rootVersion == ifAdapterVersion && rootVersion == fsAdapterVersion)){ + error("Versionen sind nicht identisch") + } + } + } + } stage('Build Eingang-Adapter') { steps { script {