Reputation: 3007
I have a parametrized Jenkins
job that gets executed every time any of the upstream jobs have a stable build; where the number of upstream jobs can vary, but at least there is always one.
(From here on, I will refer to an upstream job as upstream
and to the downstream job as downstream
)
Graphically, it's something like this:
Upstream_1 ... Upstream_N
| |
| |
\ /
\ /
\ /
| |
Downstream_Parametrized_Job
downstream
executes in a special environment the unit tests for the upstream
that triggered the execution (all upstreams
must be tested in this specific environment)
I am able to aggregate the tests results in upstream
for a specific job, but I'm having a hard time to generalize this for any number of upstream jobs.
For a single job, I've followed this solution, specifying in downstream
the name of the upstream
where to copy the fingerprinted artifact.
But this is a problem, since I can have several upstreams
and I can't specify all the names directly.
Is there a way to tell Jenkins
to take the artifact from the specific upstream
that triggered the job, without specifying a name?
So, in the picture, instead of typing UPSTREAM_1
, would it be possible to use an environment variable, something like ${UPSTREAM_JOB_NAME}
?
(here, I don't see any built-in variable like that, but I wouldn't be surprised if it weren't documented)
Upvotes: 2
Views: 302
Reputation: 14762
The Copy Artifact Plugin's page has a section:
Define a parameter UPSTREAM_JOB_NAME
in the downstream and set it accordingly when triggering from the upstream.
Upvotes: 2