Skip to content
Draft
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import hudson.Util;
import hudson.model.Run;
import hudson.model.TaskListener;
import hudson.model.Computer;
import hudson.util.Secret;
import org.jenkinsci.Symbol;
import org.jenkinsci.plugins.credentialsbinding.BindingDescriptor;
Expand Down Expand Up @@ -100,8 +101,11 @@ public String getPassphraseVariable() {
contents.append(key);
contents.append('\n');
}
keyFile.write(contents.toString(), "UTF-8");
keyFile.chmod(0400);

Computer computer = keyFile.toComputer();
keyFile.write(contents.toString(), computer.getDefaultCharset());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Computer computer = keyFile.toComputer();
keyFile.write(contents.toString(), computer.getDefaultCharset());
keyFile.write(contents.toString(), null);

as per https://javadoc.jenkins.io/hudson/FilePath.html#write-java.lang.String-java.lang.String-


keyFile.chmod(0400);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
keyFile.write(contents.toString(), computer.getDefaultCharset());
keyFile.chmod(0400);
keyFile.write(contents.toString(), computer.getDefaultCharset());
keyFile.chmod(0400);

(tabs → spaces for consistency)


Map<String, String> secretValues = new LinkedHashMap<>();
Map<String, String> publicValues = new LinkedHashMap<>();
Expand Down