I get a 401 Unauthorized error when trying to connect the Bitbucket Source Plugin to my on-prem Bitbucket Datacentre (Server) installation.
If I use my own Bitbucket.org cloud account credentials I get a different error, leading me to believe that even though I've configured the plugin to use a Bitbucket Server, it's still reaching out to the Cloud bitbucket(.org).
Versions: Jenkins: 2.110 Bitbucket Branch Source Plugin: 2.2.11 Bitbucket (datacentre): v5.7.1
Following the documentation https://go.cloudbees.com/docs/cloudbees-documentation/cje-user-guide/index.html#bitbucket There is no Advanced button to configure the Bitbucket Server/Cloud. The only configuration I found was in the Configure System [Jenkins] section;
Gobal Configuration:
Bitbucket Endpoints
In my multibranch pipeline, I've removed the Git source and added the Bitbucket Source.
Configured it with a rest API account for my Bitbucket instance. I've even added this user to the admin group Configured the Owner as a project within my Bitbucket instance
None of the other boxes let me populate them.
Running the manual scan results in the below error:
com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException: HTTP request error. Status: 401: Unauthorized.
I have personal Bitbucket.org credentials. If I use these instead (without changing any other configuration), I get the following error instead:
[Mon Apr 30 12:32:02 UTC 2018] Starting branch indexing...
Connecting to https://bitbucket.org using [email protected]/****** (My Atlassian Cloud)
ERROR: [Mon Apr 30 12:32:03 UTC 2018] Could not fetch branches from source 3f72008d-bf57-4ee3-abd4-1d2c6fb07c6e
Attention drawn to the log entry: Connecting to https://bitbucket.org
I've restarted Jenkins multiple times, thinking that the global configuration is being cached incorrectly in some way.
I'm now at the point where I believe that either I've configured the plugin in the wrong place and I can't find the correct place. Or the plugin isn't honouring the configuration and it's hardcoded (?) to always use the cloud bitbucket.
Posting a solution even though this is an old thread, as I came across the exact same issue recently (and a potential solution).
My setup was:
And I was seeing the same Could not refresh actions for navigator com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMNavigator@d0235a2 com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException: HTTP request error. Status: 401 everytine Jenkins tried to scan the BitBucket Team/Project pipeline (on the BitBucket server).
SOLUTION: This was hidden in the Jenkins configuration itself (i.e. Jenkins > Manage Jenkins > Configure System)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With