-
Bug
-
Resolution: Fixed
-
Major
-
None
-
Jenkins: 2.440.1
cloudbees-bitbucket-branch-source:880.vcf4056c5a_71f
Bitbucket Version: v8.9.5
-
-
933.3.0
Reproduction steps
- Setup multibranch pipeline with ssh checkout of mirror. Using configured admin accesstoken with repo scope.
- Jenkins does not use mirror for checkout. Instead it using the primary server
Expected Results
Jenkins should use the configured mirror
Actual Results
Mirror is not used at all. Fallback to primary server is always used for checkout. In Jenkins log the following is shown:
Could not determine mirror clone links of xxx on https://xxx for org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject@41d28fe3[Project/XXX] falling back to primary server com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException: HTTP request error. Status: 401: . HttpResponseProxy{HTTP/1.1 401 [Set-Cookie: BITBUCKETSESSIONID=XXX, X-AUSERNAME: access-token-user%2F2%2FXXXX, X-ASESSIONID: XXXX, WWW-Authenticate: OAuth realm="https%3A%2F%2Fmirror-url", ...] org.apache.http.client.entity.DecompressingEntity@6fb61eb7} at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getRequest(BitbucketServerAPIClient.java:987) at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getMirroredRepository(BitbucketServerAPIClient.java:499) at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.getCloneLinksFromMirror(BitbucketSCMSource.java:1278) at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.initMirrorCloneLinks(BitbucketSCMSource.java:1244) at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.initCloneLinks(BitbucketSCMSource.java:1238) at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.build(BitbucketSCMSource.java:1027) ...
The URL which is used in BitbucketServerAPIClient.getMirroredRepository contains already a jwt in the query parameter:
https://MIRROR_URL/rest/mirroring/latest/upstreamServers/XXX/repos/XXX?jwt=TOKEN.
If i used this URL for example with curl https://MIRROR_URL/rest/mirroring/latest/upstreamServers/XXX/repos/XXX?jwt=TOKEN the request is successful.
The API documentation of the endpoint which returns the URL of the mirror.
(https://developer.atlassian.com/server/bitbucket/rest/v803/api-group-mirroring/#api-mirroring-latest-repos-repoid-mirrors-get) says the URL contains already the authorization link to the mirror. The additional authenticator configuration is not needed.
[JENKINS-75089] Getting clone URL using mirror returns HTTP 401
Summary | Original: Clone URL using mirror returns HTTP 401 | New: Getting clone URL using mirror returns HTTP 401 |
Status | Original: Open [ 1 ] | New: In Progress [ 3 ] |
Resolution | New: Fixed [ 1 ] | |
Status | Original: In Progress [ 3 ] | New: Fixed but Unreleased [ 10203 ] |
Released As | New: 933.3.0 | |
Status | Original: Fixed but Unreleased [ 10203 ] | New: Closed [ 6 ] |
Issue create as clone from https://github.com/jenkinsci/bitbucket-branch-source-plugin/issues/829