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

Implement workaround to bypass pull request:updated/pull request: created webhook problem from Bitbucket

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • bitbucket-plugin
    • None

      Hi team,
      I have a bug to report that is more something on Bitbucket Cloud's side that we are already aware of, but it can also be worked around on the Jenkins plugin side, so we're requesting for help implementing a workaround on the plugin side at this time.
      The public Bitbucket Cloud bug I'm talking about is https://jira.atlassian.com/browse/BCLOUD-21201.

      Basically the PR:updated or PR:created payload that come from Bitbucket are being truncated, like this:

      [...]
      {"commitId":"abc15321e9fa",
      [...]
      

      This is a problem especially for the Jenkins plugin, because it breaks the git fetch command, as it expects the full commit hash to be executed.

      Unfortunately, Bitbucket Cloud can't really change this payload at the moment, because it will break other parts of our API. It would be a much greater change than simply changing this field's value.

      Here's the workaround we propose:

      • With `pullrequest:update` webhook payload received from Bitbucket Cloud, the plugin can first extract the API endpoint - {source.commit.links.self.href}

        Similar as below:

        https://api.bitbucket.org/2.0/repositories/<workspaceID>/<repo-name>/commit/<short-hash>
        
      • Then run the endpoint to obtain the commit's long hash - {hash}

        to proceed with the git fetch

      Thanks!

            tzach_solomon Tzach Solomon
            lmontiel Leonardo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: