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

Details

    Description

      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!

      Attachments

        Activity

          tzach_solomon Tzach Solomon added a comment -

          lmontiel Hi,

          1. There is not team here, I'm not related to Atlassian so sorry if it takes time to respond 

          2. Can you please provide logs? see https://support.cloudbees.com/hc/en-us/articles/115000051112-Bitbucket-Webhooks-Troubleshooting for more info on how to get those logs

          tzach_solomon Tzach Solomon added a comment - lmontiel  Hi, 1. There is not team here, I'm not related to Atlassian so sorry if it takes time to respond  2. Can you please provide logs? see https://support.cloudbees.com/hc/en-us/articles/115000051112-Bitbucket-Webhooks-Troubleshooting  for more info on how to get those logs
          tzach_solomon Tzach Solomon added a comment -

          lmontiel 

          please provide a web hook parameters to reproduce this and logs from Jenkins, thanks

          tzach_solomon Tzach Solomon added a comment - lmontiel   please provide a web hook parameters to reproduce this and logs from Jenkins, thanks
          tzach_solomon Tzach Solomon added a comment -

          lmontiel I really do want to fix this but I need the headers and body of the webhook in order to reproduce this. Please provide them. Thanks

          tzach_solomon Tzach Solomon added a comment - lmontiel  I really do want to fix this but I need the headers and body of the webhook in order to reproduce this. Please provide them. Thanks

          People

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

            Dates

              Created:
              Updated: