Skip to content
Permalink
Browse files

[FIXED JENKINS-14266] check unset variable

if env.expand don't expand a variable, this means this one has not been set, then should not break trying to parse, just ignore and let the "optional" plugin parameter fail the build if necessary
  • Loading branch information
ndeloof committed Apr 17, 2013
1 parent 4203fe7 commit c9c5de10dff176e4eb0b11116cc611895978c78d
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/main/java/hudson/plugins/copyartifact/SpecificBuildSelector.java
@@ -48,7 +48,9 @@ public String getBuildNumber() {

@Override
public Run<?,?> getBuild(Job<?,?> job, EnvVars env, BuildFilter filter, Run<?,?> parent) {
Run<?,?> run = job.getBuildByNumber(Integer.parseInt(env.expand(buildNumber)));
String buildNumber = env.expand(buildNumber);
if (buildNumber.startsWith('$')) return null; // unresolved variable, probably unset
Run<?,?> run = job.getBuildByNumber(Integer.parseInt(buildNumber));
return (run != null && filter.isSelectable(run, env)) ? run : null;
}

1 comment on commit c9c5de1

@buildhive

This comment has been minimized.

Copy link

@buildhive buildhive commented on c9c5de1 Apr 17, 2013

Jenkins » copyartifact-plugin #31 FAILURE
Looks like this commit caused a build failure
(what's this?)

Please sign in to comment.
You can’t perform that action at this time.