Heyho,
same problem here After reading Christopher's excellent analysis I create a groovy script that injects the variable for me. It simply loops over the causes until it find the cause with class name hudson.model.Cause$UpstreamCause and then injects a UPSTREAM_BUILD_NUMBER env variable. This can be used in the copyartifact step to copy "specific build number". And yes, you need additionally the groovy plugin and envinject.

=== 8< ===
import hudson.model.*
def upstreamBuildNumber
def build = Thread.currentThread().executable
def actions = build.getActions(hudson.model.CauseAction);

actions.each { action ->
action.causes.each { cause ->
if ( cause.class.name == 'hudson.model.Cause$UpstreamCause' ) {
upstreamBuildNumber = "${cause.getUpstreamBuild()}"
}
}
}

def map = [UPSTREAM_BUILD_NUMBER:upstreamBuildNumber]
return map

=== 8< ===

HTH,
Andreas

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply via email to