Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-12128

Expose releaseVersion and developmentVersion as environment variables

      When building a Maven release, the parameters Release Version and Development Version are passed to the Maven release command via -DreleaseVersion and -DdevelopmentVersion respectively.
      It would be extremely handy to expose these as environment variables so that they can be accessed throughout the job configuration; for example just like the variable WORKSPACE.

          [JENKINS-12128] Expose releaseVersion and developmentVersion as environment variables

          Code changed in jenkins
          User: imod
          Path:
          src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java
          src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseBuildWrapper.java
          http://jenkins-ci.org/commit/m2release-plugin/c78a508bcb9634c01b582ea7c3791fae86eeded0
          Log:
          [FIXED JENKINS-12128] expose dryRun flag, release and dev version as env variables

          Compare: https://github.com/jenkinsci/m2release-plugin/compare/d302d15...c78a508

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: imod Path: src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseBuildWrapper.java http://jenkins-ci.org/commit/m2release-plugin/c78a508bcb9634c01b582ea7c3791fae86eeded0 Log: [FIXED JENKINS-12128] expose dryRun flag, release and dev version as env variables Compare: https://github.com/jenkinsci/m2release-plugin/compare/d302d15...c78a508

          dogfood added a comment -

          Integrated in plugins_m2release #66
          [FIXED JENKINS-12128] expose dryRun flag, release and dev version as env variables (Revision c78a508bcb9634c01b582ea7c3791fae86eeded0)

          Result = SUCCESS
          imod :
          Files :

          • src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java
          • src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseBuildWrapper.java

          dogfood added a comment - Integrated in plugins_m2release #66 [FIXED JENKINS-12128] expose dryRun flag, release and dev version as env variables (Revision c78a508bcb9634c01b582ea7c3791fae86eeded0) Result = SUCCESS imod : Files : src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseBuildWrapper.java

          As a convenience to others who may come looking, here are the exposed env vars from the linked code above:
          MVN_RELEASE_VERSION
          MVN_DEV_VERSION
          MVN_ISDRYRUN

          Nicolas Anzalone added a comment - As a convenience to others who may come looking, here are the exposed env vars from the linked code above: MVN_RELEASE_VERSION MVN_DEV_VERSION MVN_ISDRYRUN

          It seems like this is no longer working in Jenkins 2.10 + Maven Release Plug-in Plug-in 0.14.0 ?

          When I use MVN_RELEASE_VERSION during a release build determined using IS_M2RELEASEBUILD, the value of IS_M2RELEASEBUILD is true but MVN_RELEASE_VERSION is empty string.

          Vipul Delwadia added a comment - It seems like this is no longer working in Jenkins 2.10 + Maven Release Plug-in Plug-in 0.14.0 ? When I use MVN_RELEASE_VERSION during a release build determined using IS_M2RELEASEBUILD, the value of IS_M2RELEASEBUILD is true but MVN_RELEASE_VERSION is empty string.

          James Nord added a comment -

          Please do not reopen issues that have been working for a long time. See JENKINS-35261

          James Nord added a comment - Please do not reopen issues that have been working for a long time. See JENKINS-35261

          With due respect James, I'm not sure if your reply helped me. I am still unable to print the values stored in these variables.

          I am on the Jenkins version 2.42 and with the maven release plugin version as 2.5.3

          stage('Maven release') {
           dir('myDir') {
            withMaven(maven: 'Default_Install') {
             sh "mvn -Dmaven.javadoc.skip=true -Dresume=false -B release:prepare && mvn -Dmaven.javadoc.skip=true release:perform"
            }
           }
          }
          stage('My next step') {
           dir('myDir') {
            sh "env"
             echo "Maven Release Version is $MVN_RELEASE_VERSION"
           }
          }
          

          where could I be going wrong?

          Mrinal Mukherjee added a comment - With due respect James, I'm not sure if your reply helped me. I am still unable to print the values stored in these variables. I am on the Jenkins version 2.42 and with the maven release plugin version as 2.5.3 stage( 'Maven release' ) { dir( 'myDir' ) { withMaven(maven: 'Default_Install' ) { sh "mvn -Dmaven.javadoc.skip= true -Dresume= false -B release:prepare && mvn -Dmaven.javadoc.skip= true release:perform" } } } stage( 'My next step' ) { dir( 'myDir' ) { sh "env" echo "Maven Release Version is $MVN_RELEASE_VERSION" } } where could I be going wrong?

          James Nord added a comment -

          may I suggest you take this to the users email list as this is not a help forum.

          James Nord added a comment - may I suggest you take this to the users email list as this is not a help forum.

            Unassigned Unassigned
            spots107 Jason Spotswood
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: