Skip to content

Commit

Permalink
[FIXED JENKINS-19574] Restore backward compatibility in prebuild cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
vjuranek committed Sep 15, 2013
1 parent 10cb090 commit 267f36c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/main/java/hudson/plugins/ws_cleanup/PreBuildCleanup.java
Expand Up @@ -88,7 +88,9 @@ public void preCheckout(AbstractBuild build, Launcher launcher,
try {
if (ws == null || !ws.exists())
return;
if (patterns == null || patterns.isEmpty()) {
if ((patterns == null || patterns.isEmpty()) && (externalDelete == null || externalDelete.isEmpty())) {
ws.deleteRecursive();
} else {
build.getWorkspace().act(new Cleanup(patterns,deleteDirs, build.getBuiltOn().getNodeProperties().get(
EnvironmentVariablesNodeProperty.class), externalDelete, listener));
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/hudson/plugins/ws_cleanup/WsCleanup.java
Expand Up @@ -158,10 +158,9 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen
listener.getLogger().append("Skipped based on build state " + build.getResult() + "\n\n");
return true;
}
if ((patterns == null || patterns.isEmpty()) && externalDelete.length() == 0) {
if ((patterns == null || patterns.isEmpty()) && (externalDelete == null || externalDelete.isEmpty())) {
workspace.deleteRecursive();
} else {

workspace.act(
new Cleanup(
patterns,
Expand Down

0 comments on commit 267f36c

Please sign in to comment.