Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-14233

Include all commits included in the push in the event payload of the RepositoryPushEvent

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • None
    • Webhooks
    • None
    • 1
    • We collect Bitbucket feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

    Description

      Background

      The event payload for the RepositoryPushEvent Java API / Repository events - Push webhook only includes a fromHash and a toHash value.

      If there are multiple commits included in the push, they are not included in the payload.
      Only the commit before the first commit (fromHash value) and the last commit (toHash value are included).

      Sample

      Given the following series of Git operations and log:

      # First push
      <edit file.txt>
      git add file.txt
      git commit -m "before multiple commits in one push"
      git push
      
      # Second push
      <edit file.txt>
      git add file.txt
      git commit -m "first commit"
      <edit file.txt>
      git add file.txt
      git commit -m "second commit"
      <edit file.txt>
      git add file.txt
      git commit -m "third commit"
      git push
      

      Git log 

      commit 0ccf14a8f5eb25aa69a2366cdbcde1612d229446 (HEAD -> master, origin/master, origin/HEAD)
      Author: user1 <user1@test.com>
      Date:   Tue Jul 4 16:30:25 2023 +1000
      
          third commit
      
      commit e6a1f354022b4a8bc234ce2c66f817e258e4cde1
      Author: user1 <user1@test.com>
      Date:   Tue Jul 4 16:30:18 2023 +1000
      
          second commit
      
      commit d110db3a2f204a2a52efdde527e969d2455633ae
      Author: user1 <user1@test.com>
      Date:   Tue Jul 4 16:30:12 2023 +1000
      
          first commit
      
      commit ec67f717e46e3d0eed01ee93cf2faf5c2a1f8ece
      Author: user1 <user1@test.com>
      Date:   Tue Jul 4 16:30:02 2023 +1000
      
          before multiple commits in one push
      
      • First push: Commit ec67f717e46e3d0eed01ee93cf2faf5c2a1f8ece was committed and then pushed to the remote
      • Second push: Commits d110db3a2f204a2a52efdde527e969d2455633ae, e6a1f354022b4a8bc234ce2c66f817e258e4cde1, 0ccf14a8f5eb25aa69a2366cdbcde1612d229446 are committed locally and then pushed to the remote at the same time

       

      The Repository Event - Push webhook payload for the second push will show:

      {
        "eventKey": "repo:refs_changed",
        "date": "2023-07-04T16:30:28+1000",
        "actor": {
          "name": "admin",
          "emailAddress": "user1@test.com",
          "id": 2,
          "displayName": "admin",
          "active": true,
          "slug": "admin",
          "type": "NORMAL",
          "links": {
            "self": [
              { "href": "http://localhost:7990/users/admin" }
            ]
          }
        },
        "repository": {
          "slug": "repo7175a",
          "id": 1,
          "name": "repo7175a",
          "hierarchyId": "374f1d313b9ccec62c49",
          "scmId": "git",
          "state": "AVAILABLE",
          "statusMessage": "Available",
          "forkable": true,
          "project": {
            "key": "PROJ1",
            "id": 1,
            "name": "Project 1",
            "public": false,
            "type": "NORMAL",
            "links": {
              "self": [
                {
                  "href": "http://localhost:7990/projects/PROJ1"
                }
              ]
            }
          },
          "public": true,
          "links": {
            "clone": [
              {
                "href": "http://localhost:7990/scm/proj1/repo7175a.git",
                "name": "http"
              },
              {
                "href": "ssh://git@localhost:7999/proj1/repo7175a.git",
                "name": "ssh"
              }
            ],
            "self": [
              {
                "href": "http://localhost:7990/projects/PROJ1/repos/repo7175a/browse"
              }
            ]
          }
        },
        "changes": [
          {
            "ref": {
              "id": "refs/heads/master",
              "displayId": "master",
              "type": "BRANCH"
            },
            "refId": "refs/heads/master",
            "fromHash": "ec67f717e46e3d0eed01ee93cf2faf5c2a1f8ece",
            "toHash": "0ccf14a8f5eb25aa69a2366cdbcde1612d229446",
            "type": "UPDATE"
          }
        ]
      }
      
      • it only includes the commit hash before the second push as the fromHash value (ec67f717e46e3d0eed01ee93cf2faf5c2a1f8ece) and the last commit included in the push as the toHash value (0ccf14a8f5eb25aa69a2366cdbcde1612d229446)

      Feature request

      Include all commits that are part of the push in the event payload for the RepositoryPushEvent Java API / Repository events - Push webhook.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jmariano@atlassian.com JP Mariano
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: