Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-25192] rely on archived artifacts to trigger (paramete…
…rized) build

fallback to workspace for backward compatibility
  • Loading branch information
ndeloof committed Jan 6, 2015
1 parent 666e72e commit 77355b7
Showing 1 changed file with 15 additions and 11 deletions.
Expand Up @@ -4,13 +4,7 @@
import hudson.Extension;
import hudson.FilePath;
import hudson.Util;
import hudson.model.AbstractBuild;
import hudson.model.Action;
import hudson.model.Descriptor;
import hudson.model.ParameterValue;
import hudson.model.ParametersAction;
import hudson.model.StringParameterValue;
import hudson.model.TaskListener;
import hudson.model.*;
import hudson.util.FormValidation;
import hudson.matrix.AxisList;
import hudson.matrix.Combination;
Expand Down Expand Up @@ -113,12 +107,22 @@ private List<ParameterValue> extractAllValues(AbstractBuild<?,?> build, TaskList
List<ParameterValue> values = new ArrayList<ParameterValue>();
EnvVars env = getEnvironment(build, listener);
for(String file:allFiles) {
FilePath f = build.getWorkspace().child(file);
FilePath f = null;
// First try to retrieve as a build artifact, so we don't need build workspace to be online
for (Run.Artifact artifact : build.getArtifacts()) {
if (artifact.relativePath.equals(file)) {
f = new FilePath(artifact.getFile());
break;
}
}
if (f == null) {
f = build.getWorkspace().child(file);
}
if (!f.exists()) {
listener.getLogger().println("[parameterizedtrigger] Properties file "
+ file + " did not exist.");
if(getFailTriggerOnMissing()) {
listener.getLogger().println("Not triggering due to missing file");
+ file + " did not exist.");
if (getFailTriggerOnMissing()) {
listener.getLogger().println("Not triggering due to missing file - did you archive it as a build artifact ?");
throw new DontTriggerException();
}
// goto next file.
Expand Down

0 comments on commit 77355b7

Please sign in to comment.