Skip to content
Snippets Groups Projects
Commit 11e0d836 authored by OZGCloud's avatar OZGCloud
Browse files

add version check to jenkins pipeline

parent f1ce80c6
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,8 @@ pipeline { ...@@ -9,6 +9,8 @@ pipeline {
environment { environment {
BLUE_OCEAN_URL = "https://jenkins.ozg-sh.de/blue/organizations/jenkins/intelliform-adapter/detail/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/pipeline" 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 { options {
...@@ -18,6 +20,42 @@ pipeline { ...@@ -18,6 +20,42 @@ pipeline {
} }
stages { 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') { stage('Build Eingang-Adapter') {
steps { steps {
script { script {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment