diff options
author | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2019-05-06 15:18:00 +0200 |
---|---|---|
committer | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2019-05-06 16:37:07 +0200 |
commit | 726ba08018dad3254e8fcdbaa8fd5fa58e4bb30e (patch) | |
tree | 40d61f66cda7e6a8de2a81afb4dcc446cfc95e6f | |
parent | d8b4c679ba3de823038d539a6c7226cb192bc92e (diff) |
Allow key/cert identity for submit plugin
-rw-r--r-- | hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java | 2 | ||||
-rw-r--r-- | vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/SubmitMojo.java | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java b/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java index 7710f3c6129..9b4f91d8a41 100644 --- a/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java +++ b/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java @@ -162,7 +162,7 @@ public abstract class ControllerHttpClient { private SigningControllerHttpClient(URI endpoint, Path privateKeyFile, ApplicationId id) { super(endpoint, HttpClient.newBuilder()); - this.signer = new RequestSigner(unchecked(() -> Files.readString(privateKeyFile)), id.serializedForm()); + this.signer = new RequestSigner(unchecked(() -> Files.readString(privateKeyFile, UTF_8)), id.serializedForm()); } @Override diff --git a/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/SubmitMojo.java b/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/SubmitMojo.java index f3360d975c6..b0bb22fad99 100644 --- a/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/SubmitMojo.java +++ b/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/SubmitMojo.java @@ -50,6 +50,9 @@ public class SubmitMojo extends AbstractMojo { @Parameter(property = "privateKeyFile", required = true) private String privateKeyFile; + @Parameter(property = "certificateFile") + private String certificateFile; + @Parameter(property = "authorEmail", required = true) private String authorEmail; @@ -66,9 +69,9 @@ public class SubmitMojo extends AbstractMojo { public void execute() { setup(); ApplicationId id = ApplicationId.from(tenant, application, instance); - ControllerHttpClient controller = ControllerHttpClient.withSignatureKey(URI.create(endpointUri), - Paths.get(privateKeyFile), - id); + ControllerHttpClient controller = certificateFile == null + ? ControllerHttpClient.withSignatureKey(URI.create(endpointUri), Paths.get(privateKeyFile), id) + : ControllerHttpClient.withAthenzIdentity(URI.create(endpointUri), Paths.get(privateKeyFile), Paths.get(certificateFile)); Submission submission = new Submission(repository, branch, commit, authorEmail, Paths.get(applicationZip), Paths.get(applicationTestZip)); |