amuniz / bitbucket-branch-source-plugin

5 stars 2 forks source link

Add support for app passwords #16

Open DoDoENT opened 6 years ago

DoDoENT commented 6 years ago

Original report here: https://issues.jenkins-ci.org/browse/JENKINS-45129

When trying to scan for branches using the user which has two-step verification enabled, I get the following error:

Started
[Mon Jun 26 11:04:33 CEST 2017] Starting branch indexing...
ERROR: [Mon Jun 26 11:04:33 CEST 2017] Could not update folder level actions from source 85788dfe-8acb-4d5b-b6c5-64622c0ae982
com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException: HTTP request error. Status: 403: Forbidden.
To make an API call, you need to use an app password.
at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.getRequest(BitbucketCloudApiClient.java:572)
at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.getRepository(BitbucketCloudApiClient.java:236)
at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.retrieveActions(BitbucketSCMSource.java:689)
at jenkins.scm.api.SCMSource.fetchActions(SCMSource.java:691)
at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:587)
at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:266)
at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:162)
at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:969)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:415)
[Mon Jun 26 11:04:33 CEST 2017] Finished branch indexing. Indexing took 0.35 sec
FATAL: Failed to recompute children of ocr-engine
com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException: HTTP request error. Status: 403: Forbidden.
To make an API call, you need to use an app password.
at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.getRequest(BitbucketCloudApiClient.java:572)
at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.getRepository(BitbucketCloudApiClient.java:236)
at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.retrieveActions(BitbucketSCMSource.java:689)
at jenkins.scm.api.SCMSource.fetchActions(SCMSource.java:691)
at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:587)
at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:266)
at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:162)
at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:969)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:415)
Finished: FAILURE

We would like to enable enforcement for all our developers to use two-step verification for logging into BitBucket, but are unable to do so until Bitbucket branch source plugin gets the ability to use app password for making API calls.