Skip to content

Commit

Permalink
- initial POM pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
puce77 committed May 18, 2020
1 parent 434ecfd commit 295a47d
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
69 changes: 69 additions & 0 deletions vars/pom.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
def call(String mavenVersion, String javaVersion){
pipeline {
agent any
triggers {
pollSCM('H/10 * * * *')
}
tools {
maven mavenVersion
jdk javaVersion
}
// options {
// timestamps()
// ansiColor("xterm")
// }
parameters {
booleanParam(name: "RELEASE",
description: "Build a release from current commit.",
defaultValue: false)
string(name:"versionDigitToIncrement",
description:"Which digit to increment. Starts from zero.",
defaultValue: "1")
}
stages {
stage ('Initialize') {
steps {
sh '''
echo "PATH = ${PATH}"
echo "M2_HOME = ${M2_HOME}"
'''
}
}

stage ('Build non-master branches') {
when {
not {
branch 'master'
}
}
steps {
sh 'mvn clean install -DperformRelease=true'
}
}

stage ('Build & deploy master branch') {
when {
branch 'master'
not { expression { params.RELEASE } }
}
steps {
sh 'mvn clean deploy -DperformRelease=true'
}
}

stage ('Release') {
when {
branch 'master'
expression { params.RELEASE }
}
steps {
// release {
sh 'mvn -B -e gitflow:release-start -DperformRelease=true -DversionDigitToIncrement=${versionDigitToIncrement}'
sh 'mvn -B -e gitflow:release-finish -DperformRelease=true -DversionDigitToIncrement=${versionDigitToIncrement} -DpostReleaseGoals="deploy -DperformRelease=true" -Dverbose=true'
// }
}
}
}

}
}
1 change: 1 addition & 0 deletions vars/pom.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A pipeline for Maven POM packaging projects

0 comments on commit 295a47d

Please sign in to comment.