From cf4056c5a71fd4fba79dca033efb64893fb36625 Mon Sep 17 00:00:00 2001 From: Martin Helwig <115872657+MartinHelwig@users.noreply.github.com> Date: Wed, 13 Mar 2024 15:58:47 +0100 Subject: [PATCH] use checkoutCredentialsId if available (#821) --- .../jenkins/plugins/bitbucket/BitbucketGitSCMBuilder.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/BitbucketGitSCMBuilder.java b/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/BitbucketGitSCMBuilder.java index e2a2eb0d4..9c2f1ce56 100644 --- a/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/BitbucketGitSCMBuilder.java +++ b/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/BitbucketGitSCMBuilder.java @@ -23,6 +23,7 @@ */ package com.cloudbees.jenkins.plugins.bitbucket; +import com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.DescriptorImpl; import com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketAuthenticator; import com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketHref; import com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRepository; @@ -160,7 +161,7 @@ public BitbucketGitSCMBuilder withCredentials(String credentialsId, BitbucketRep StandardCredentials credentials = BitbucketCredentials.lookupCredentials( scmSource.getServerUrl(), scmSource.getOwner(), - credentialsId, + DescriptorImpl.SAME.equals(scmSource.getCheckoutCredentialsId()) ? credentialsId : scmSource.getCheckoutCredentialsId(), StandardCredentials.class );