Skip to content

Commit

Permalink
Merge pull request #312 from jtnord/remove-FileOnMasterKeySource-2
Browse files Browse the repository at this point in the history
Remove missed occurence of FileOnMasterKeyStoreSource
  • Loading branch information
jtnord authored Jul 3, 2024
2 parents 6288482 + f6d0b67 commit f91669a
Showing 1 changed file with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ public void basicsPipeline() throws Exception {
String alias = "androiddebugkey";
String password = "android";
StandardCertificateCredentials c = new CertificateCredentialsImpl(CredentialsScope.GLOBAL, "my-certificate", alias,
password, new CertificateCredentialsImpl.FileOnMasterKeyStoreSource(certificate.getAbsolutePath()));
password, new CertificateCredentialsImpl.UploadedKeyStoreSource(new FileParameterValue.FileItemImpl(certificate), null));
CredentialsProvider.lookupStores(r.jenkins).iterator().next().addCredentials(Domain.global(), c);
// create the Pipeline job
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
String pipelineScript = IOUtils.toString(getTestResourceInputStream("basicsPipeline-Jenkinsfile"), StandardCharsets.UTF_8);
String pipelineScript = getTestResourceAsUTF8String("basicsPipeline-Jenkinsfile");
p.setDefinition(new CpsFlowDefinition(pipelineScript, true));
// copy resources into workspace
FilePath workspace = r.jenkins.getWorkspaceFor(p);
Expand All @@ -170,13 +170,20 @@ private InputStream getTestResourceInputStream(String fileName) {
return getClass().getResourceAsStream(getClass().getSimpleName() + "/" + fileName);
}

private String getTestResourceAsUTF8String(String resourceName) throws IOException {
try (InputStream is = getTestResourceInputStream(resourceName)) {
return IOUtils.toString(is, StandardCharsets.UTF_8);
}
}

private FilePath copyTestResourceIntoWorkspace(FilePath workspace, String fileName, int mask)
throws IOException, InterruptedException {
InputStream in = getTestResourceInputStream(fileName);
FilePath f = workspace.child(fileName);
f.copyFrom(in);
f.chmod(mask);
return f;
try (InputStream in = getTestResourceInputStream(fileName)) {
FilePath f = workspace.child(fileName);
f.copyFrom(in);
f.chmod(mask);
return f;
}
}

}

0 comments on commit f91669a

Please sign in to comment.