From 11e87d1a513b0a550ab000949142ea267613ac45 Mon Sep 17 00:00:00 2001 From: Vincent Latombe Date: Thu, 26 Oct 2023 08:46:45 +0200 Subject: [PATCH 1/2] Downstream usage of new jep-227 APIs --- pom.xml | 5 +++++ .../plugins/credentialsbinding/BindingDescriptor.java | 2 +- .../plugins/credentialsbinding/impl/ZipFileBinding.java | 2 +- .../impl/SSHUserPrivateKeyBindingTest.java | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index c02e8c22..1e4d6980 100644 --- a/pom.xml +++ b/pom.xml @@ -56,6 +56,11 @@ import pom + + org.jenkins-ci.plugins + credentials + 1305.v5886374f499b_ + diff --git a/src/main/java/org/jenkinsci/plugins/credentialsbinding/BindingDescriptor.java b/src/main/java/org/jenkinsci/plugins/credentialsbinding/BindingDescriptor.java index 8bf3c80d..89f85ad5 100644 --- a/src/main/java/org/jenkinsci/plugins/credentialsbinding/BindingDescriptor.java +++ b/src/main/java/org/jenkinsci/plugins/credentialsbinding/BindingDescriptor.java @@ -60,7 +60,7 @@ public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item owner) { // when configuring the job, you only want those credentials that are available to ACL.SYSTEM selectable // as we cannot select from a user's credentials unless they are the only user submitting the build // (which we cannot assume) thus ACL.SYSTEM is correct here. - return new Model().withAll(CredentialsProvider.lookupCredentials(type(), owner, ACL.SYSTEM, Collections.emptyList())); + return new Model().withAll(CredentialsProvider.lookupCredentialsInItem(type(), owner, ACL.SYSTEM2, Collections.emptyList())); } private final class Model extends AbstractIdCredentialsListBoxModel { diff --git a/src/main/java/org/jenkinsci/plugins/credentialsbinding/impl/ZipFileBinding.java b/src/main/java/org/jenkinsci/plugins/credentialsbinding/impl/ZipFileBinding.java index 83d535d8..86897a54 100644 --- a/src/main/java/org/jenkinsci/plugins/credentialsbinding/impl/ZipFileBinding.java +++ b/src/main/java/org/jenkinsci/plugins/credentialsbinding/impl/ZipFileBinding.java @@ -92,7 +92,7 @@ public FormValidation doCheckCredentialsId(StaplerRequest req, @AncestorInPath I return FormValidation.ok(); } } - for (FileCredentials c : CredentialsProvider.lookupCredentials(FileCredentials.class, owner, null, Collections.emptyList())) { + for (FileCredentials c : CredentialsProvider.lookupCredentialsInItem(FileCredentials.class, owner, null, Collections.emptyList())) { if (c.getId().equals(value)) { InputStream is = null; try { diff --git a/src/test/java/org/jenkinsci/plugins/credentialsbinding/impl/SSHUserPrivateKeyBindingTest.java b/src/test/java/org/jenkinsci/plugins/credentialsbinding/impl/SSHUserPrivateKeyBindingTest.java index 99d5feda..59b75a8a 100644 --- a/src/test/java/org/jenkinsci/plugins/credentialsbinding/impl/SSHUserPrivateKeyBindingTest.java +++ b/src/test/java/org/jenkinsci/plugins/credentialsbinding/impl/SSHUserPrivateKeyBindingTest.java @@ -193,7 +193,7 @@ public CredentialsScope getScope() { assertTrue(key.exists()); assertEquals(keyContent, key.readToString().trim()); - ((DummyPrivateKey) CredentialsProvider.lookupCredentials(SSHUserPrivateKey.class, story.j.jenkins, ACL.SYSTEM, Collections.emptyList()).get(0)).usernameSecret = false; + ((DummyPrivateKey) CredentialsProvider.lookupCredentialsInItemGroup(SSHUserPrivateKey.class, story.j.jenkins, ACL.SYSTEM2, Collections.emptyList()).get(0)).usernameSecret = false; SemaphoreStep.success("basics/2", null); b = story.j.buildAndAssertSuccess(p); story.j.assertLogContains(username, b); From 058e7497ece690e5cc23fb12282b72ac2bede40c Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Wed, 1 Nov 2023 17:18:54 -0400 Subject: [PATCH 2/2] Pick up release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1e4d6980..55fdd653 100644 --- a/pom.xml +++ b/pom.xml @@ -59,7 +59,7 @@ org.jenkins-ci.plugins credentials - 1305.v5886374f499b_ + 1307.v3757c78f17c3