From e5338574b29acf1888657a7cfc7bcc2c91d9d2da Mon Sep 17 00:00:00 2001 From: Vincent Latombe Date: Thu, 26 Oct 2023 09:11:14 +0200 Subject: [PATCH 1/3] jep-227 downstream usage --- pom.xml | 5 +++++ src/main/java/hudson/plugins/git/UserRemoteConfig.java | 8 ++++---- .../java/jenkins/plugins/git/AbstractGitSCMSource.java | 4 ++-- src/main/java/jenkins/plugins/git/GitSCMFileSystem.java | 4 ++-- src/main/java/jenkins/plugins/git/GitSCMSource.java | 6 +++--- src/main/java/jenkins/plugins/git/GitSCMTelescope.java | 6 +++--- 6 files changed, 19 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index c1b1a694f9..70ba6e06a7 100644 --- a/pom.xml +++ b/pom.xml @@ -92,6 +92,11 @@ pom import + + org.jenkins-ci.plugins + credentials + 1305.v5886374f499b_ + diff --git a/src/main/java/hudson/plugins/git/UserRemoteConfig.java b/src/main/java/hudson/plugins/git/UserRemoteConfig.java index a405d18db2..6f1dd6e33b 100644 --- a/src/main/java/hudson/plugins/git/UserRemoteConfig.java +++ b/src/main/java/hudson/plugins/git/UserRemoteConfig.java @@ -149,9 +149,9 @@ public FormValidation doCheckCredentialsId(@AncestorInPath Item project, return FormValidation.ok(); } for (ListBoxModel.Option o : CredentialsProvider - .listCredentials(StandardUsernameCredentials.class, project, project instanceof Queue.Task - ? Tasks.getAuthenticationOf((Queue.Task) project) - : ACL.SYSTEM, + .listCredentialsInItem(StandardUsernameCredentials.class, project, project instanceof Queue.Task + ? Tasks.getAuthenticationOf2((Queue.Task) project) + : ACL.SYSTEM2, GitURIRequirementsBuilder.fromUri(url).build(), GitClient.CREDENTIALS_MATCHER)) { if (Objects.equals(value, o.value)) { @@ -259,7 +259,7 @@ public FormValidation doCheckRefspec(@QueryParameter String name, private static StandardCredentials lookupCredentials(@CheckForNull Item project, String credentialId, String uri) { return (credentialId == null) ? null : CredentialsMatchers.firstOrNull( - CredentialsProvider.lookupCredentials(StandardCredentials.class, project, ACL.SYSTEM, + CredentialsProvider.lookupCredentialsInItem(StandardCredentials.class, project, ACL.SYSTEM2, GitURIRequirementsBuilder.fromUri(uri).build()), CredentialsMatchers.withId(credentialId)); } diff --git a/src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java b/src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java index d67c897706..aa08eb197c 100644 --- a/src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java +++ b/src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java @@ -1288,8 +1288,8 @@ private StandardUsernameCredentials getCredentials(@CheckForNull Item context) { } return CredentialsMatchers .firstOrNull( - CredentialsProvider.lookupCredentials(StandardUsernameCredentials.class, context, - ACL.SYSTEM, URIRequirementBuilder.fromUri(getRemote()).build()), + CredentialsProvider.lookupCredentialsInItem(StandardUsernameCredentials.class, context, + ACL.SYSTEM2, URIRequirementBuilder.fromUri(getRemote()).build()), CredentialsMatchers.allOf(CredentialsMatchers.withId(credentialsId), GitClient.CREDENTIALS_MATCHER)); } diff --git a/src/main/java/jenkins/plugins/git/GitSCMFileSystem.java b/src/main/java/jenkins/plugins/git/GitSCMFileSystem.java index a8998fb229..7e146bc563 100644 --- a/src/main/java/jenkins/plugins/git/GitSCMFileSystem.java +++ b/src/main/java/jenkins/plugins/git/GitSCMFileSystem.java @@ -368,10 +368,10 @@ public SCMFileSystem build(@NonNull Item owner, @NonNull SCM scm, @CheckForNull String credentialsId = config.getCredentialsId(); if (credentialsId != null) { StandardCredentials credential = CredentialsMatchers.firstOrNull( - CredentialsProvider.lookupCredentials( + CredentialsProvider.lookupCredentialsInItem( StandardUsernameCredentials.class, owner, - ACL.SYSTEM, + ACL.SYSTEM2, URIRequirementBuilder.fromUri(remote).build() ), CredentialsMatchers.allOf( diff --git a/src/main/java/jenkins/plugins/git/GitSCMSource.java b/src/main/java/jenkins/plugins/git/GitSCMSource.java index a4ecc310bc..894ae2b7f9 100644 --- a/src/main/java/jenkins/plugins/git/GitSCMSource.java +++ b/src/main/java/jenkins/plugins/git/GitSCMSource.java @@ -451,12 +451,12 @@ public FormValidation doCheckCredentialsId(@AncestorInPath Item context, return FormValidation.ok(); } - for (ListBoxModel.Option o : CredentialsProvider.listCredentials( + for (ListBoxModel.Option o : CredentialsProvider.listCredentialsInItem( StandardUsernameCredentials.class, context, context instanceof Queue.Task - ? Tasks.getAuthenticationOf((Queue.Task) context) - : ACL.SYSTEM, + ? Tasks.getAuthenticationOf2((Queue.Task) context) + : ACL.SYSTEM2, URIRequirementBuilder.fromUri(remote).build(), GitClient.CREDENTIALS_MATCHER)) { if (Objects.equals(value, o.value)) { diff --git a/src/main/java/jenkins/plugins/git/GitSCMTelescope.java b/src/main/java/jenkins/plugins/git/GitSCMTelescope.java index 44492fe3cc..9862c34d92 100644 --- a/src/main/java/jenkins/plugins/git/GitSCMTelescope.java +++ b/src/main/java/jenkins/plugins/git/GitSCMTelescope.java @@ -195,10 +195,10 @@ public final SCMFileSystem build(@NonNull Item owner, @NonNull SCM scm, SCMRevis String credentialsId = config.getCredentialsId(); if (credentialsId != null) { List urlCredentials = CredentialsProvider - .lookupCredentials(StandardUsernameCredentials.class, owner, + .lookupCredentialsInItem(StandardUsernameCredentials.class, owner, owner instanceof Queue.Task - ? Tasks.getAuthenticationOf((Queue.Task) owner) - : ACL.SYSTEM, URIRequirementBuilder.fromUri(remote).build()); + ? Tasks.getAuthenticationOf2((Queue.Task) owner) + : ACL.SYSTEM2, URIRequirementBuilder.fromUri(remote).build()); credentials = CredentialsMatchers.firstOrNull( urlCredentials, CredentialsMatchers From c87d8bf8df00703c3041fca4e9777b2a57176068 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Wed, 1 Nov 2023 17:22:48 -0400 Subject: [PATCH 2/3] Pick up release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 70ba6e06a7..62d676eb3e 100644 --- a/pom.xml +++ b/pom.xml @@ -95,7 +95,7 @@ org.jenkins-ci.plugins credentials - 1305.v5886374f499b_ + 1307.v3757c78f17c3 From 056f12a59728c24370f46fcd51fcbdc0cb3dc14b Mon Sep 17 00:00:00 2001 From: Mark Waite Date: Sun, 5 Nov 2023 21:20:52 -0700 Subject: [PATCH 3/3] Rely on plugin bom for credentials plugin version Credentials 1307.v3757c78f17c3 is provided by plugin bom --- pom.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pom.xml b/pom.xml index 44cf8df45b..cac1669ace 100644 --- a/pom.xml +++ b/pom.xml @@ -92,11 +92,6 @@ pom import - - org.jenkins-ci.plugins - credentials - 1307.v3757c78f17c3 -