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

bitbucket source plugin fails with bad URL

XMLWordPrintable

      The new status notifier code cause the BBSP plugin to fail with an unclear error message when the RootURL has not been specifically configured.

      This job worked with the 1.5 plugin from before the status notifier code was added, and fails in 1.8.

      First time build. Skipping changelog.
      [Bitbucket] Notifying commit build result
      [Bitbucket] Notifying commit build result
      com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException: HTTP request error. Status: 400: BAD REQUEST.
      {"error": {"fields": {"url": ["Enter a valid URL."]}, "message": "Bad request"}}
      	at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.postRequest(BitbucketCloudApiClient.java:496)
      	at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.postRequest(BitbucketCloudApiClient.java:523)
      	at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.postBuildStatus(BitbucketCloudApiClient.java:311)
      	at com.cloudbees.jenkins.plugins.bitbucket.BitbucketChangesetCommentNotifier.buildStatus(BitbucketChangesetCommentNotifier.java:49)
      	at com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications.createBuildCommitStatus(BitbucketBuildStatusNotifications.java:87)
      	at com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications.sendNotifications(BitbucketBuildStatusNotifications.java:173)
      	at com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications.access$000(BitbucketBuildStatusNotifications.java:61)
      	at com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications$JobCheckOutListener.onCheckout(BitbucketBuildStatusNotifications.java:192)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:123)
      	at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:108)
      	at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:85)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:214)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:410)
      

      This is especially confusing given running the code in the plugin in the groovy console results in:

      def instance = Jenkins.getInstance()
      def bar_job = instance.getAllItems(WorkflowJob).find { it.getFullName() == "foo/bar/master"}
      def bar_last_build =  bar_job.getLastBuild()
      println DisplayURLProvider.get().getRunURL(bar_last_build)
      
      Result: https://my.fqdn.example.com/job/foo/job/bar/job/master/2/
      

      The confusion gets worse when navigating to the system configuration page appears to show the jenkins root url as configured (as autodetected) with the fqdn, whereas internally it's null.

      With changing nothing other than clicking save on the system configuration page (which then commits the autodetected fqdn as the actual rooturl) the job then completes successfully.

            stephenconnolly Stephen Connolly
            hogarthj James Hogarth
            Votes:
            7 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: