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

Merge pull request 'OZG-5907 update jenkinsfile to upload jars from branches'...

Merge pull request 'OZG-5907 update jenkinsfile to upload jars from branches' (#23) from OZG-5907 into master
parents 23a4a1d1 a293c6ba
Branches
Tags
No related merge requests found
......@@ -49,6 +49,26 @@ pipeline {
}
}
}*/
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"
}
}
}
stage('Build OzgCloud-Common Dependencies') {
steps {
script {
......@@ -91,18 +111,14 @@ pipeline {
}
stage('Deploy OzgCloud-Common to Nexus'){
when {
anyOf {
branch 'master'
branch 'release'
}
}
steps {
script {
FAILED_STAGE = env.STAGE_NAME
}
configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) {
sh 'mvn --no-transfer-progress -s $MAVEN_SETTINGS deploy'
sh "mvn -s $MAVEN_SETTINGS versions:revert"
}
}
}
......@@ -140,3 +156,9 @@ String getElementAccessToken() {
return readJSON ( text: sh (script: '''curl -XPOST -d \"$LOGIN_JSON\" https://matrix.ozg-sh.de/_matrix/client/v3/login''', returnStdout: true)).access_token
}
}
String getPomVersion(String pomFile){
def pom = readMavenPom file: pomFile
return pom.version
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment