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

The generated key for notifications can be more than the 40 character limit which fails

    XMLWordPrintable

Details

    Description

      This is essentially the same issue as JENKINS-32781, occurs when using the latest version of the plugin built off master (testing out new build status notifications). Bitbucket requires the key to be <= 40 characters but it looks like right now the job name is being used which for my case with pipelines would be the branch name which is typically fairly long because we're using auto generated branch names from Jira (uses jira number + title). Also, I'm not sure what the desired uniqueness is here but in JENKINS-32781 the key is the project name + build number so each build can have a unique status e.g. built once and tests were flakey and it failed but then built again and it passed - depends if you want the build status to record both runs or just the latest one.

      The diff from JENKINS-32781 for reference - https://github.com/jenkinsci/bitbucket-build-status-notifier-plugin/commit/d73ec91ad424e4f885a7961579a55ccf1299d5e2

      Callstack for reference on failed builds (created a long branch name to test this):

      [Bitbucket] Notifying commit build result
      com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException: HTTP request error. Status: 400: BAD REQUEST.
      {"error": {"fields": {"key": ["Ensure this value has at most 40 characters (it has 119)."]}, "message": "Bad request"}}
          at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.postRequest(BitbucketCloudApiClient.java:486)
          at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.postRequest(BitbucketCloudApiClient.java:513)
          at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.postBuildStatus(BitbucketCloudApiClient.java:303)
          at com.cloudbees.jenkins.plugins.bitbucket.BitbucketChangesetCommentNotifier.buildStatus(BitbucketChangesetCommentNotifier.java:49)
          at com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications.createBuildCommitStatus(BitbucketBuildStatusNotifications.java:85)
          at com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications.sendNotifications(BitbucketBuildStatusNotifications.java:171)
          at com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications.access$000(BitbucketBuildStatusNotifications.java:60)
          at com.cloudbees.jenkins.plugins.bitbucket.BitbucketBuildStatusNotifications$JobCheckOutListener.onCheckout(BitbucketBuildStatusNotifications.java:190)
          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:207)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:410)
      Finished: FAILURE
      

      Attachments

        Issue Links

          Activity

            People

              amuniz Antonio Muñiz
              rrupp Ryan Rupp
              Votes:
              5 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: