The following plugin provides functionality available through Pipeline-compatible steps. Read more about how to integrate steps into your Pipeline in the Steps section of the Pipeline Syntax page.
For a list of other such plugins, see the Pipeline Steps Reference page.
currentVersion
: determine the current version from the conventional commit historyThis step can be used to determine the current version of supported projects types. The supported configuration files :
nextVersion
: Next Version: determine the next version from the conventional commit historyDetermine the next release version based on previous tags and the commit messages used. It calculates the version number based on the format of the commit message. The commit message format used is conventional commits.
This plugin can be used in a pipeline in a stage or the environment block. Some examples of this in use are:
In the environment block:
pipeline {
agent any
environment {
NEXT_VERSION = nextVersion()
}
stages {
stage('Hello') {
steps {
echo "next version = ${NEXT_VERSION}"
}
}
}
}
In a scripted Pipeline: def NEXT_VERSION
node {
stage('Get next version ...') {
NEXT_VERSION=nextVersion()
echo "Next version : $NEXT_VERSION"
}
stage ('Release') {
sh "mvn release:prepare -DreleaseVersion=$NEXT_VERSION"
sh 'mvn release:perform'
}
}
buildMetadata : String
(optional)
An optional parameter can be added as follows:
pipeline {
agent any
environment {
NEXT_VERSION = nextVersion(buildMetadata: "$env.BUILD_NUMBER")
}
stages {
stage('Hello') {
steps {
echo "next version = ${NEXT_VERSION}"
}
}
}
}
Assuming next version is 1.1.0. The pipeline will output: next version = 1.1.0+001
incrementPreRelease : boolean
(optional)
There are three options to manipulate the prerelease option:
preRelease
preservePrelease
incrementPreRelease
nonAnnotatedTag : boolean
(optional)
If false use only annotated tags, if true use all tags to determine next version
outputFormat : String
(optional)
preRelease : String
(optional)
For a 1.0.0
existing version the following code:
pipeline {
agent any
environment {
NEXT_VERSION = nextVersion(preRelease: 'alpha')
}
stages {
stage('Hello') {
steps {
echo "next version = ${NEXT_VERSION}"
}
}
}
}
Will display: next version = 1.1.0-alpha
preservePreRelease : boolean
(optional)
There are three options to manipulate the prerelease option:
preRelease
preservePrelease
incrementPreRelease
startTag : String
(optional)
writeVersion : boolean
(optional)
Allow writing back to the file the next calculated version.
Please submit your feedback about this page through this quick form.
Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?
See existing feedback here.