Skip to content

Commit

Permalink
[JENKINS-23084] [FIXED JENKINS-22229] Allow using parameter files eve…
Browse files Browse the repository at this point in the history
…n if no workspace exists.
  • Loading branch information
ikedam committed May 18, 2014
1 parent c9f8bf5 commit 7f79c14
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
Expand Up @@ -99,11 +99,6 @@ public Action getAction(AbstractBuild<?,?> build, TaskListener listener)
Collection<? extends AbstractBuild<?,?>> targetBuilds = getTargetBuilds(build);

for (AbstractBuild<?,?> targetBuild: targetBuilds) {
if (!targetBuild.getWorkspace().exists()) {
// This is a case that the workspace is already removed.
LOGGER.log(Level.WARNING, "workspace for {0} is already removed. skip.", targetBuild.getDisplayName());
continue;
}
values.addAll(extractAllValues(targetBuild, listener, allFiles));
}
//Values might be empty, in that case don't return anything.
Expand Down
Expand Up @@ -792,4 +792,32 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen
return true;
}
}

@Bug(22229)
public void testAbsolutePathWithoutWorkspace() throws Exception {
// Though it is rather a problem with ws-cleanup-plugin,
// there's a case a workspace is removed.
FreeStyleProject downstream = createFreeStyleProject();

FreeStyleProject upstream = createFreeStyleProject();

File absoluteFile = new File(jenkins.getRootDir(), "properties.txt");
FileUtils.writeStringToFile(absoluteFile, "absolute_param=value1");

upstream.getBuildersList().add(new WorkspaceRemoveBuilder());
upstream.getPublishersList().add(new BuildTrigger(
new BuildTriggerConfig(downstream.getFullName(), ResultCondition.SUCCESS, true, Arrays.<AbstractBuildParameters>asList(
new FileBuildParameters(absoluteFile.getAbsolutePath())
))
));

jenkins.rebuildDependencyGraph();

assertBuildStatusSuccess(upstream.scheduleBuild2(0));
waitUntilNoActivity();

FreeStyleBuild build = downstream.getLastBuild();
assertNotNull(build);
assertEquals("value1", getStringParameterValue(build, "absolute_param"));
}
}

0 comments on commit 7f79c14

Please sign in to comment.