Skip to content
Browse files
Merge pull request #7 from fredg02/master
merged tivv's pull request and adapted test for [JENKINS-11828]
  • Loading branch information
fredg02 committed Nov 28, 2011
2 parents 6ff97e6 + 901ba64 commit 4fb9dba52c63c433cd44403af71067c79f2764e5
@@ -46,7 +46,6 @@
import hudson.model.Hudson;
import hudson.model.Job;
import hudson.model.Item;
import hudson.model.ParametersDefinitionProperty;
import hudson.model.Project;
import hudson.model.Run;
import hudson.model.TaskListener;
@@ -25,10 +25,7 @@

import hudson.Extension;
import hudson.FilePath;
import hudson.model.Hudson;

* Default implementation of CopyMethod extension point,
@@ -27,6 +27,7 @@
import hudson.Extension;
import hudson.matrix.MatrixConfiguration;
import hudson.matrix.MatrixRun;
import hudson.model.Result;
import hudson.model.Descriptor;
import hudson.model.Cause;
import hudson.model.Cause.UpstreamCause;
@@ -73,7 +74,7 @@ public Run<?,?> getBuild(Job<?,?> job, EnvVars env, BuildFilter filter, Run<?,?>

protected boolean isSelectable(Run<?,?> run, EnvVars env) {
return isFallbackToLastSuccessful();
return isFallbackToLastSuccessful() && run.getResult().isBetterOrEqualTo(Result.SUCCESS);

@@ -65,6 +65,7 @@
import org.jvnet.hudson.test.ExtractResourceSCM;
import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.CaptureEnvironmentBuilder;
import org.jvnet.hudson.test.FailureBuilder;
import org.jvnet.hudson.test.UnstableBuilder;

@@ -504,6 +505,12 @@ public void testTriggeredBuildSelector() throws Exception {
// Verify error if build not triggered by upstream job:
assertBuildStatus(Result.FAILURE, p.scheduleBuild2(0, new UserCause()).get());
// test fallback

//run a failing build to make sure the fallback selects the last successful build
other.getBuildersList().add(new FailureBuilder());
assertBuildStatus(Result.FAILURE, other.scheduleBuild2(0, new UserCause()).get());

p.getBuildersList().add(new CopyArtifact(other.getName(),
new TriggeredBuildSelector(true), "*.txt", "", false, false));

0 comments on commit 4fb9dba

Please sign in to comment.