Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How can I configure Jenkins to interact with Bitbucket Cloud secured by Okta?

David Kushner June 14, 2018

We have a corporate Bitbucket Cloud team set up with all of our access mediated by Okta. I would like to connect the Jenkins Multibranch Pipeline plugin to our Bitbucket repositories as described here: https://support.cloudbees.com/hc/en-us/articles/115000051132-How-to-Trigger-Multibranch-Jobs-from-BitBucket-Cloud-

We have created a separate automation account in our organization, with an associated Okta identity. I have configured MFA for both Okta and Bitbucket as required by the Bitbucket-Okta integration. This is, for all intents and purposes, a full-fledged Bitbucket account with all the same access as my developer account.

I have followed the aforementioned guide to the letter, creating credentials in Jenkins with the automation account's username and password. However, when I attempt to run the pipeline, and the plugin attempts to scan our target repository, it receives a 401 HTTP response from the Bitbucket API endpoint.

Has anyone managed to accomplish this integration, and if so, how did you do so? The end goal of this is to enable Jenkins build status updates to feed back into comments of the PR that triggered it (and other neat review/tracking features).

2 answers

0 votes
James Davidson January 14, 2019

Hello,

Instead of doing a repository scan, may I recommend that you try setting up the Generic Webhook Trigger Plugin ?

At the moment I think that it is the best way to tell Jenkins to run a job. In each webhook payload from Bitbucket Cloud there will be a commit id. Extract that commit id, put it in an environment variable and then use it as the 'branch source' for the git checkout at the start of your build.

Then at the end of each build, you can use the Bitbucket Cloud build status notifier plugin to add feed back to pull requests (including direct links to green and red builds). Unlike the trigger step, this plugin will require OAuth credentials.

Good luck!

James

0 votes
Sudhanshu Mathur November 30, 2018

Hi @David Kushner

Were you able to find a solution for this.

Thanks

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events