[HAP-606] Expose Release SCM Branch and Release SCM Tag as build variables Created: 29/May/15  Updated: 13/Jul/15  Resolved: 07/Jul/15

Status: Resolved
Project: Jenkins Artifactory Plug-in
Component/s: Release Management
Affects Version/s: None
Fix Version/s: 2.3.1

Type: New Feature Priority: Normal
Reporter: guy rooms Assignee: Eyal Ben Moshe (Inactive)
Resolution: Fixed Votes: 1
Labels: artifactory, jenkins


when using "Artifactory Release Staging", one of the things which is suggested by the plugin is the "VCS Tag Name/URL".
It would be nice to have this value exposed as an environment variable so we can use it.

Concrete case: we pass the SVN_URL from the main job to the downstream job to be sure to checkout the same revision; this principle works fine, yet not when releasing...

When releasing, the main job gets (1) a release version and (2) gets tagged, while the downstream job gets the original SVN_URL (on trunk, with snapshot version).

also see:

Comment by Eyal Ben Moshe (Inactive) [ 02/Jun/15 ]

We exposed two variables as part of the Artifactory Release Staging build: RELEASE_SCM_TAG and RELEASE_SCM_BRANCH.
You can pass their values on to other jobs by, for example, using the ”Trigger parameterized build on other projects” post build action.
This feature will be included as part of the next Jenkins Artifactory Plugin release, but you can try out the below snapshot version. We'd appreciate your feedback for it.
Link for downloading the snapshot version:

Comment by guy rooms [ 02/Jun/15 ]

Thx for the quick response!
So, what happened next:

  • snapshot version was installed ok (+ jenkins restart)
  • release build failed: "[RELEASE] You are using an old subversion jenkins plugin, please consider upgrading."
  • I updated "Subversion plug-in" from 2.4.3 to 2.4.5 (+ jenkins restart)
  • still have the same build error: "[RELEASE] You are using an old subversion jenkins plugin, please consider upgrading."

current jenkins install: ver 1.564 / I guess we'll need to update that first ?

apart from that, I added a small groovy script (see further) as a "Post Build Step", but can't see the env vars you're mentioning. Are these vars only set at the very end (when the release process is actually running) ? If so, well, It would be nice to have them available before that, preferable from the start (since all info is present at the very beginning of the job). This would allow some (groovy) logic in between...

groovy script:

System.env.sort{it.key}.each {k,v -> println "$k:$v"}

Comment by Eyal Ben Moshe (Inactive) [ 02/Jun/15 ]

Appreciate your feedback,
1. If you're releasing a Maven 3 build, please use this snapshot:
(the previous one supports only Gradle releases. This one supports both).
2. We tried adding the variables in an early stage of the build.
3. Yes, you'll need to use at least version 2.5 of the Subversion Plugin.

Comment by guy rooms [ 03/Jun/15 ]

1. we were indeed using maven3
upgraded to the latest plugin you provided + restarted jenkins
2. unfortunately the two env variables you mention do not show up upon a release build, tried both with groovy script as with linux script (printenv)

3. in the meantime, I'm still working on updating jenkins / Subversion plugin. Once I get passed that, I can at least verify if the env vars are set after the actual release step.

Comment by guy rooms [ 03/Jun/15 ]


  • I setup a new jenkins (v1.600) with Subversion Plug-in (v2.5) and your latest plugin (2.3.1-SNAPSHOT (private-06/02/2015 16:24-jenkins-agent))
  • for a maven3 build, on release, the two env variables you mention do not show up in a (linux) "post step"
  • also when triggering parameterized downstream build (with "test=${RELEASE_SCM_BRANCH}"), the env var is not resolved/filled-in
Comment by Eyal Ben Moshe (Inactive) [ 03/Jun/15 ]

Please note that the RELEASE_SCM_TAG and RELEASE_SCM_BRANCH variables are build specific and not global env variables. You can pass them from one build to another by using the ”Trigger parameterized build on other projects” post build action.

Comment by guy rooms [ 03/Jun/15 ]

Sure, and that's also exactly what I'm doing:
1. add the ”Trigger parameterized build on other projects” with the following predefined parameters:

2. in the downstream build, the parameter list shows:
test1: http://<our-svn-url>
test2: ${RELEASE_SCM_BRANCH} (with other words: unresolved)

Comment by Eyal Ben Moshe (Inactive) [ 03/Jun/15 ]

I may have managed to reproduce the issue you're experiencing and modified the code to fix it:

Comment by guy rooms [ 03/Jun/15 ]

Sorry, but no luck

  • installed your latest snapshot + restarted jenkins
  • confirmed it is installed: version in plugin-manager shows: 2.3.1-SNAPSHOT (private-06/03/2015 11:00-jenkins-agent)
  • run (release) the root project.
  • two ENVS still not visible in post build step (linux shell) of root project
  • RELEASE_SCM_BRANCH still not resolved in the downstream project
Comment by Eyal Ben Moshe (Inactive) [ 03/Jun/15 ]

I sent the wrong snapshot link (my apologies).
This is the correct one:

Comment by guy rooms [ 03/Jun/15 ]

OK, that update makes a difference: the principles DO work now

  • in post build (linux shell) I see RELEASE_SCM_TAG env var (containing the SCM-Branch-url)
  • parameter is correctly propagated to the downstream job
    So that's good news ! thx !

Just one question: Will this be the final solution, having a single env var (RELEASE_SCM_TAG) containing the SVN-branch name ? Suites me fine, btw

Comment by Eyal Ben Moshe (Inactive) [ 03/Jun/15 ]

This behavior will most probably not change.
In case we do decide to modify it in some way before the next release (this is still an integration version), we'll make sure to update this Jira issue accordingly.

Comment by guy rooms [ 03/Jun/15 ]

OK, thx. Any idea when this next release would be available ?

Comment by Eyal Ben Moshe (Inactive) [ 04/Jun/15 ]

We currently do not have a date for the next plugin release, but we expect it to be release during Q3 of this year.

Generated at Wed Jun 03 01:30:37 UTC 2020 using Jira 8.5.3#805003-sha1:b4933e02eaff29a49114274fe59e1f99d9d963d7.