You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What Operating System are you using (both controller, and any agents involved in the problem)?
Amazon Linux for controller and agents: see Enviroment
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)
...
Anything else?
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 ex with curl https://MIRROR_URL/rest/mirroring/latest/upstreamServers/XXX/repos/XXX?jwt=TOKEN the request is successful.
Are you interested in contributing a fix?
No response
The text was updated successfully, but these errors were encountered:
If getRequest is called from getMirroredRepository with the self link which contains already the token as query parameter, the request is failing with 401 if the authenticator (in my case its an instance of BitbucketAccessTokenAuthenticator which adds the Bearer Authorization header) is used. If i remove the header the request is sucessfull. With the header the request is failing with 401.
Also note that the url contains the url of the mirrored bitbucket instance and not the url of the primary bitbucket instance. The token itself is configured for the primary instance.
Jenkins and plugins versions report
Environment
Bitbucket Version: v8.9.5
What Operating System are you using (both controller, and any agents involved in the problem)?
Amazon Linux for controller and agents: see Enviroment
Reproduction steps
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:
Anything else?
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 ex with
curl https://MIRROR_URL/rest/mirroring/latest/upstreamServers/XXX/repos/XXX?jwt=TOKEN
the request is successful.Are you interested in contributing a fix?
No response
The text was updated successfully, but these errors were encountered: