-
Bug
-
Resolution: Not A Defect
-
Critical
-
None
-
- Bitbucket Cloud -> Jenkins
- Multibranch Pipeline
- jenkins Slave
According this description it is possible to checkout a Bitbucket repository with an access token:
[Using Repository Access Tokens | Bitbucket Cloud | Atlassian Support|https://support.atlassian.com/bitbucket-cloud/docs/using-access-tokens/]
We have generated an access token and added it as an secret text to the jenkins credentials.
it is possible list all repos in your plugin.
builds gets triggered by pull requests and branch events.
by generating a access token in Bitbucket also generates a pseudo username
somehow this username is part of the git url during the PR checkout and the authentification fails
we run our builds on a jenkins slave. i had similiar problems on the slave when i used
"scm checkout"
i had to change this command to:
def scmUrl = scm.getUserRemoteConfigs()[0].getUrl()
URL scmUri = new URL(scmUrl)
def protocol = scmUri?.getProtocol()
def host = scmUri?.getHost()
def path = scmUri?.getPath()
def newUrl = "${protocol}://${host}${path}"
checkout([
$class: 'GitSCM',
branches: scm.branches,
doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations,
extensions: scm.extensions,
userRemoteConfigs: [
[url: newUrl, credentialsId: 'x-token-auth']
]
])
to overwrite the username and refer to the authentification token.
that worked fine, but the problem with the PR happens much earlier in the build and i can't find a solution.
i hope you can find a solution.
Thank you
Özdem