Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-67399

Sometimes tries to use OAuth to connect to Bitbucket when Basic credential configured.

XMLWordPrintable

      Intermittently we get failures to get source or notify Bitbucket of build status which show the following errors.

      com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException: HTTP request error. Status: 401: . HttpResponseProxy

      {HTTP/1.1 401 [Server: nginx, Date: Fri, 17 Dec 2021 11:59:17 GMT, Content-Type: application/json;charset=UTF-8, Transfer-Encoding: chunked, Connection: keep-alive, X-AREQUESTID: @1E51M4Hx719x57504526x4, X-ASEN: <redacted>, Cache-Control: no-cache, no-transform, Vary: accept-encoding,x-auserid,cookie,x-ausername,accept-encoding, WWW-Authenticate: OAuth realm="https%3A%2F%2F<redacted>", X-Content-Type-Options: nosniff] org.apache.http.client.entity.DecompressingEntity@7ca853a7}

      at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.doRequest(BitbucketServerAPIClient.java:1095) at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.postRequest(BitbucketServerAPIClient.java:1048) at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.postRequest(BitbucketServerAPIClient.java:1036) at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.postBuildStatus(BitbucketServerAPIClient.java:511) at com.cloudbees.jenkins.plugins.bitbucket.BitbucketChangesetCommentNotifier.buildStatus(BitbucketChangesetCommentNotifier.java:50) at com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications.createStatus(BitbucketBuildStatusNotifications.java:161) at com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications.sendNotifications(BitbucketBuildStatusNotifications.java:203) at com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications.access$100(BitbucketBuildStatusNotifications.java:59) at com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications$JobCompletedListener.onCompleted(BitbucketBuildStatusNotifications.java:285) at hudson.model.listeners.RunListener.fireCompleted(RunListener.java:208) at org.jenkinsci.plugins.workflow.job.WorkflowRun.finish(WorkflowRun.java:625) at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$800(WorkflowRun.java:138) at org.jenkinsci.plugins.workflow.job.WorkflowRun$GraphL.onNewHead(WorkflowRun.java:1045) at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.notifyListeners(CpsFlowExecution.java:1472) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$3.run(CpsThreadGroup.java:491) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:38) at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:139) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68) 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)

       
      com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException: HTTP request error. Status: 401: .

       

      HttpResponseProxy

      {HTTP/1.1 401 [Server: nginx, Date: Thu, 16 Dec 2021 15:22:56 GMT, Content-Type: application/json;charset=UTF-8, Transfer-Encoding: chunked, Connection: keep-alive, X-AREQUESTID: @1E51M4Hx922x56159881x3, X-ASEN: <redacted>, Cache-Control: no-cache, no-transform, Vary: accept-encoding,x-auserid,cookie,x-ausername,accept-encoding, WWW-Authenticate: OAuth realm="https%3A%2F%2F<redacted>", X-Content-Type-Options: nosniff] org.apache.http.client.entity.DecompressingEntity@53042323}

       at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getRequest(BitbucketServerAPIClient.java:883) at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getResources(BitbucketServerAPIClient.java:835)<redacted> at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getServerBranches(BitbucketServerAPIClient.java:588) <redacted> at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getBranches(BitbucketServerAPIClient.java:579) at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.retrieve(BitbucketSCMSource.java:795) at jenkins.scm.api.SCMSource.fetch(SCMSource.java:582) at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:100) at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:310) at hudson.model.ResourceController.execute(ResourceController.java:99) at hudson.model.Executor.run(Executor.java:432)
       
      I don't understand why it would try and use OAuth authentication when the credentials configured are username/password.

      99% of the time both actions work fine.

            flagbit Antonio Mansilla
            sfryffdc Stephen Fry
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: