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

OZG-6227 update jenkinsfile to upload jars from branches

parent 7ec67608
No related branches found
No related tags found
No related merge requests found
......@@ -39,6 +39,26 @@ pipeline {
}
}
} //stage check version
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') {
steps {
script {
......@@ -50,18 +70,14 @@ pipeline {
}
} //stage build
stage('Deploy 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 -s $MAVEN_SETTINGS -Pdeploy -DskipTests deploy'
sh 'mvn -s $MAVEN_SETTINGS versions:revert'
}
}
} //stage deploy
......@@ -99,3 +115,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