Merge pull request #2895 from abayer/jenkins-34464
[JENKINS-34464] Switch ReverseBuildTrigger.threshold to DataBoundSetter
This commit is contained in:
commit
4515a07518
|
@ -73,6 +73,7 @@ import org.apache.commons.lang.StringUtils;
|
|||
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;
|
||||
|
@ -91,12 +92,21 @@ 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;
|
||||
|
||||
/**
|
||||
* 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);
|
||||
this.threshold = threshold;
|
||||
}
|
||||
|
||||
@DataBoundConstructor
|
||||
public ReverseBuildTrigger(String upstreamProjects, Result threshold) {
|
||||
public ReverseBuildTrigger(String upstreamProjects) {
|
||||
this.upstreamProjects = upstreamProjects;
|
||||
this.threshold = threshold;
|
||||
}
|
||||
|
||||
public String getUpstreamProjects() {
|
||||
|
@ -107,6 +117,11 @@ public final class ReverseBuildTrigger extends Trigger<Job> implements Dependenc
|
|||
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) {
|
||||
|
|
Loading…
Reference in New Issue