DotCi icon indicating copy to clipboard operation
DotCi copied to clipboard

downstream job unable to access default jenkins variable

Open ghost opened this issue 9 years ago • 2 comments

Downstream job is not able access BUILD_NUMBER from default JenkinsSetEnvironmentVariables

Based on the following .ci.yml

plugins:
  - downstream_job:
      on_result: SUCCESS
      foo/bar:
        VERSION: <% out<< printf("%06d", BUILD_NUMBER.toInteger()) << "-" << DOTCI_SHA.substring(0,10) %>
        BRANCH: master

Resulted in null per attached output from foo/bar

screen shot 2016-03-11 at 4 29 46 pm

Aside from groovy script, I don't see any way to compute values to pass dynamic variable to build parameters since bash commands will not work outside of the build run section.

ghost avatar Mar 11 '16 22:03 ghost

Also confirmed Downstream job is not able to pass the default String Parameter values that a job may have configured ...

For example job/foo/job/bar/configured with IMAGE default as "mysql" and TAG default as "5.7" screen shot 2016-04-12 at 12 45 38 pm

but its invocation via downstream results in the following console error output

$ docker pull $IMAGE:$TAG

instead of the following console output when invoked manually (i.e. not downstream job)

$ docker pull mysql:5.7

ghost avatar Apr 12 '16 18:04 ghost

sorry for bringing this back from the shadows, have you found a way to work around this issue?

I stumbled upon this because I have to dynamically generate a var in a build and pass it to the downstream job (unfortunately I can't directly use the parameterized trigger build plugin for this purpose)

raulvc avatar Dec 28 '16 17:12 raulvc