Skip to content

Conversation

@SergK
Copy link
Member

@SergK SergK commented Dec 21, 2025

Description

This PR fixes an issue where GitLab webhook payloads return null for merge_commit_sha when using fast-forward or squash merge strategies, causing build pipelines to fail. The fix changes the triggerbinding to use extensions.pullRequest.headSha instead, which correctly maps to the last_commit.id field that is always available in GitLab merge request webhooks.

Fixes #569

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Enhancement (non-breaking change which improves an existing feature or documentation)
  • Breaking change (fix or feature that would cause existing functionality not to work as expected)

How Has This Been Tested?

Tested with GitLab merge request events in an environment configured with fast-forward merge strategy. Verified that the TriggerBinding now correctly extracts the commit SHA from extensions.pullRequest.headSha, which is populated by the interceptor from the last_commit.id field in the webhook payload.

Checklist:

  • I have performed a self-review of my code
  • I have commented on my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Pull Request contains one commit. I squash my commits.

Screenshots (if appropriate):

N/A

Additional context

The GitLab API documentation states that merge_commit_sha returns null until the MR is merged, and remains null for fast-forward merge strategies. The last_commit.id field is always available and represents the head commit of the merge request, making it the reliable choice for triggering build pipelines on merge request events.

…ate merge commit (#569)

Signed-off-by: Sergiy Kulanov <sergiy_kulanov@epam.com>
@SergK SergK requested a review from a team as a code owner December 21, 2025 08:56
@SergK
Copy link
Member Author

SergK commented Dec 21, 2025

/recheck

@zmotso zmotso self-requested a review December 22, 2025 08:31
@MykolaMarusenko MykolaMarusenko merged commit d27cbf8 into master Dec 22, 2025
7 checks passed
@MykolaMarusenko MykolaMarusenko deleted the fix-git-sha-for-fastforward branch December 22, 2025 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GitLab webhook merge_commit_sha is null for fast-forward merge strategy

4 participants