nishio-dens / bitbucket-pullrequest-builder-plugin

Bitbucket Pull Request Builder Plugin for Jenkins
Other
125 stars 145 forks source link

Bitbucket Cloud recently stopped supporting account passwords for API authentication #235

Open binakot opened 2 years ago

binakot commented 2 years ago

Good day. Can this plugin works after cancelling password authentication? I cannot configure plugin to works right now 😢

I tried to use App Password and OAuth token, but it doesn't help. Every time I got 401 Unauthorized error and logs below:

WARNING: Bitbucket Cloud recently stopped supporting account passwords for API authentication.
See our community post for more details: https://atlassian.community/t5/x/x/ba-p/1948231
App passwords are recommended for most use cases and can be created in your Personal settings:
https://bitbucket.org/account/settings/app-passwords/
For more details on API authentication methods see our documentation:
https://developer.atlassian.com/cloud/bitbucket/rest/intro/#authentication
bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.bitbucket.server.ServerApiClient getAllValues
            WARNING: invalid response.
            java.lang.NullPointerException
            at java.base/java.io.StringReader.<init>(StringReader.java:50)
            at org.codehaus.jackson.JsonFactory.createJsonParser(JsonFactory.java:636)
            at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1877)
            at bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.bitbucket.ApiClient.parse(ApiClient.java:210)
            at bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.bitbucket.server.ServerApiClient.getAllValues(ServerApiClient.java:122)
            at bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.bitbucket.server.ServerApiClient.getPullRequests(ServerApiClient.java:37)
            at bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.BitbucketRepository.getTargetPullRequests(BitbucketRepository.java:116)
            at bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.BitbucketPullRequestsBuilder.run(BitbucketPullRequestsBuilder.java:37)
            at bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.BitbucketBuildTrigger$TriggerRunnable.run(BitbucketBuildTrigger.java:414)
            at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
            at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
            at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
            at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
            at java.base/java.lang.Thread.run(Thread.java:829)
CodeMonk commented 2 years ago

I believe the plugin needs actual usernames and passwords, not the api token or oauth. Feel free to extend the code if you need it!