Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-32943] Use a standardized temporary directory for secretFiles.
  • Loading branch information
jglick committed Feb 22, 2016
1 parent 689655d commit 8661953
Showing 1 changed file with 7 additions and 6 deletions.
Expand Up @@ -27,10 +27,9 @@
import hudson.Extension;
import hudson.FilePath;
import hudson.Launcher;
import hudson.model.Computer;
import hudson.model.Node;
import hudson.model.Run;
import hudson.model.TaskListener;
import hudson.slaves.WorkspaceList;
import java.io.IOException;
import java.util.UUID;

Expand Down Expand Up @@ -86,10 +85,12 @@ private static class UnbinderImpl implements Unbinder {
}

private static FilePath secretsDir(FilePath workspace) {
Computer computer = workspace.toComputer();
Node node = computer == null ? null : computer.getNode();
FilePath root = node == null ? workspace : node.getRootPath();
return root.child("secretFiles");
return tempDir(workspace).child("secretFiles");
}

// TODO move to WorkspaceList
private static FilePath tempDir(FilePath ws) {
return ws.sibling(ws.getName() + System.getProperty(WorkspaceList.class.getName(), "@") + "tmp");
}

protected void copy(FilePath secret, FileCredentials credentials) throws IOException, InterruptedException {
Expand Down

0 comments on commit 8661953

Please sign in to comment.