Adri C.S.
Adri C.S.

Reputation: 3007

Aggregating test results for multiple upstream jobs

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.

Getting the artifact from the upstream

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

Answers (1)

Gerold Broser
Gerold Broser

Reputation: 14762

The Copy Artifact Plugin's page has a section:

Specifying project dynamically (with variables)

Define a parameter UPSTREAM_JOB_NAME in the downstream and set it accordingly when triggering from the upstream.

Upvotes: 2

Related Questions