Hi,
The CopyArtifact plugin with 'Upstream build that triggered this job' works fine for us for a chain of jobs when the build started with the first job that triggers the next one, which triggers the next, and so on. The advantage of the Upstream-build strategy is that it works even with overlapping chains of builds. But there is a problem when we have overlapping chains and the build is started with an intermediate job.
Let's consider a simple scenario: each job triggers the next one
- ModuleA --> ModuleB --> Publisher
where
- ModuleB depends on artifacts of ModuleA (using the Upstream-build strategy),
- Publisher copies artifacts from ModuleA and ModuleB (using the Upstream-build strategy),
- ModuleB needs significantly more time to build than ModuleA, so ModuleA can build while a ModuleB build is running.
Example execution:
- ModuleA#1 is triggered by SCM, builds successfully.
- ModuleB#1 is triggered by ModuleA#1, copies its artifacts and builds successfully.
- Publisher#1 is triggered by ModuleB#1, copies artifacts from ModuleA#1 and ModuleB#1.
- ModuleB#2 is triggered by SCM, copies artifacts from ModuleA#1 (fallback to last successful), build started...
- ModuleA#2 is triggered by SCM, builds successfully.
- ... ModuleB#2 finished.
- Publisher#2 is triggered by ModuleB#2, copies artifacts from ModuleB#2 and ModuleA#2 (fallback) instead of ModuleA#1, which ModuleB#2 depends on.
- ModuleB#3 and Publisher#3 works as expected.
This scenario happens more easily if the chain is longer and contains more than 3 jobs.
The problem here is the inconsistent builds (here the Publisher), or the violated isolation of build chains.
I hope what I've written so far is a reasonable issue.
What I found to this is that, the Upstream-build strategy in CopyArtifact plugin could include the upstream builds of the target build, not just the builds that triggered it. I have implemented this change introducing an additional checkbox for this, tried on a local Jenkins installation and seems working.
Could someone help me how to continue?
Should we test the change more thoroughly in our CI system before a pull request?
The change can be found
here.
I've found a
related issue for MultiJobs, but my change doesn't seem to help on that.
Thank you,
Gabor