Skip to content

Add option to 'Upstream build that triggered this job' to allow upstream dependencies #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 17, 2015

Conversation

gvasko
Copy link
Contributor

@gvasko gvasko commented Oct 15, 2015

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.

@jenkinsadmin
Copy link
Member

Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests

@@ -93,16 +95,18 @@ public boolean isForGlobalSetting() {
};
private Boolean fallbackToLastSuccessful;
private final UpstreamFilterStrategy upstreamFilterStrategy;
private Boolean allowUpstreamDependencies;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use boolean here as it's set to false if not configured.
You have to use Boolean if:

  • You want to know it's not configured and want to run an upgrading process.
  • You want to set it to true if not configured.

@gvasko
Copy link
Contributor Author

gvasko commented Oct 16, 2015

Thank you, I will fix them soon.

@ikedam
Copy link
Member

ikedam commented Oct 17, 2015

Thanks for the update!
It's time to merge.

ikedam added a commit that referenced this pull request Oct 17, 2015
Add option to 'Upstream build that triggered this job' to allow upstream dependencies
@ikedam ikedam merged commit 0eb798b into jenkinsci:master Oct 17, 2015
@gvasko
Copy link
Contributor Author

gvasko commented Oct 17, 2015

Thanks for your support.

@ikedam
Copy link
Member

ikedam commented Oct 31, 2015

Released as copyartifact-1.37.
It will be available in the update center in a day.

@gvasko
Copy link
Contributor Author

gvasko commented Oct 31, 2015

Thanks, that sounds fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants