Skip to content

Commit

Permalink
Merge pull request #2895 from abayer/jenkins-34464
Browse files Browse the repository at this point in the history
[JENKINS-34464] Switch ReverseBuildTrigger.threshold to DataBoundSetter
  • Loading branch information
daniel-beck committed Jun 24, 2017
2 parents 2b8b189 + ba5a053 commit 4515a07
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions core/src/main/java/jenkins/triggers/ReverseBuildTrigger.java
Expand Up @@ -73,6 +73,7 @@
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.AncestorInPath;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.QueryParameter;

import javax.annotation.Nonnull;
Expand All @@ -91,14 +92,23 @@ public final class ReverseBuildTrigger extends Trigger<Job> implements Dependenc
private static final Logger LOGGER = Logger.getLogger(ReverseBuildTrigger.class.getName());

private String upstreamProjects;
private final Result threshold;
private Result threshold = Result.SUCCESS;

@DataBoundConstructor
/**
* Legacy constructor used before {@link #threshold} was moved to a {@code @DataBoundSetter}. Kept around for binary
* compatibility.
*/
@Deprecated
public ReverseBuildTrigger(String upstreamProjects, Result threshold) {
this.upstreamProjects = upstreamProjects;
this(upstreamProjects);
this.threshold = threshold;
}

@DataBoundConstructor
public ReverseBuildTrigger(String upstreamProjects) {
this.upstreamProjects = upstreamProjects;
}

public String getUpstreamProjects() {
return upstreamProjects;
}
Expand All @@ -107,6 +117,11 @@ public Result getThreshold() {
return threshold;
}

@DataBoundSetter
public void setThreshold(Result r) {
this.threshold = r;
}

private boolean shouldTrigger(Run upstreamBuild, TaskListener listener) {
Jenkins jenkins = Jenkins.getInstance();
if (job == null) {
Expand Down

0 comments on commit 4515a07

Please sign in to comment.