Copy artifacts from multiple upstream jobs when merged into Jenkins

Is it possible that Jenkins Job with was triggered by artifacts of copying a plug-in from multiple upstream jobs?

Iโ€™m trying to configure Jenkins using the โ€œdiamondโ€ of tasks: starting my-trigger and creating two tasks, my-fork1 and my-fork2, which can run at the same time and take different time intervals, and the Join plugin sets up the my-join task after both forks.

Each of my triggers, my-fork1 and my-fork2, creates fingerprint artifacts (say, text files).

I want to copy artifacts from each of the above tasks to my-join using the Copy Artifacts from Another Project tool, with the "What assembly" option set to "The original assembly that called this task". However, I see output like this in the my-join console:

Remote creation on a prefab in a workspace / path / to / workspace / my-join

1 artifact copied out of order No. 63 "my-trigger"

1 artifact copied out of order No. 63 "my-fork1"

Unable to find assembly for artifact copy from: my-fork2

and job failure. In this case, my-fork2 finished first, so my-fork1 initiated the connection step. I believe this means that in my connection there is only a record of my-fork1 and my-trigger as upstream. If my-fork1 ends first, then my-fork2 starts the connection, and the job does not work when trying to copy from my-fork1.

If I reconfigured to copy an artifact from the Last Successful Assembly assembly, the assembly will succeed, but my trigger can run many times in a row, so there is no guarantee that my attachment will merge related artifacts.

How can I get a join step to copy artifacts from multiple forks upstream?

Note: the second point of this question seems to ask the same thing, but the only answer there is not affected and accepted.

Thank you tensor product

+7
source share
2 answers

If your assemblies are parameterized with a unique parameter for each brilliant join run, you can use this parameter in the CopyArtifact plugin to determine which assembly you want to copy. You want to specify "Last successful build" and specify it with a parameter and value.

We have a similar situation when I work; multiple simultaneous runs of the diamond compound. A parameter in the assembly allows tasks downstream to receive the correct artifacts from the overlying tasks.

+9
source

Step-by-step settings of the provided solution from Jason Swager:

Project Dependencies: diamond> fork-> diamond_ready

Fork project: String parameter UNIQUE_ID (only a dummy element is not used internally) (Creates an artifact and archives artifacts)

Project "diamond_ready" String parameter: UNIQUE_ID Copying artifacts from another project Project name: fork Parameter filters: UNIQUE_ID = $ {UNIQUE_ID}

Diamond project: A trigger with parameterization is built on another project. Projects for assembly: fork Predefined parameters: UNIQUE_ID = $ {BUILD_TAG} Join trigger: Actions after attachment: Trigger is parameterized in other projects Assembly projects: diamond_ready Predefined generator parameters: UNIQUE_ID = $ {BUILD_TAG}

0
source

All Articles