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.

Conventional Commits Plugin

currentVersion: determine the current version from the conventional commit history

This step can be used to determine the current version of supported projects types. The supported configuration files :

  • Maven,
  • Gradle,
  • Helm,
  • Make,
  • Python,
  • Npm.

    nextVersion: Next Version: determine the next version from the conventional commit history

    Determine 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 (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

      • Type: String
    • incrementPreRelease (optional)

      There are three options to manipulate the prerelease option:

      • the name of the prerelease ➡️ preRelease
      • keep the existing prerelease (default false) ➡️ preservePrelease
      • increment the existing prerelease (default false) ➡️ incrementPreRelease
      The table described in here are the combined use of these options and the result.

      • Type: boolean
    • nonAnnotatedTag (optional)

      If false use only annotated tags, if true use all tags to determine next version

      • Type: boolean
    • outputFormat (optional)

      • Type: String
    • preRelease (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

      • Type: String
    • preservePreRelease (optional)

      There are three options to manipulate the prerelease option:

      • the name of the prerelease ➡️ preRelease
      • keep the existing prerelease (default false) ➡️ preservePrelease
      • increment the existing prerelease (default false) ➡️ incrementPreRelease
      The table described in here are the combined use of these options and the result.

      • Type: boolean
    • startTag (optional)

      • Type: String
    • writeVersion (optional)

      Allow writing back to the file the next calculated version.

      • Type: boolean

    Was this page helpful?

    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.