Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push event from Gitlab wihout new commit cause error #182

Open
sylvainp opened this issue May 24, 2024 · 0 comments
Open

Push event from Gitlab wihout new commit cause error #182

sylvainp opened this issue May 24, 2024 · 0 comments

Comments

@sylvainp
Copy link

Hi 👋

I trying to setup an incoming webhook from Bitrise on Gitlab push event.
In my team workflow, we push an empty branch for creating new release. According to Gitlab documentation,commits fields array is empty :

If you create and push a branch without any new commits, the commits attribute in the payload is empty.

Source : Gitlab push event documentation

When webhook is triggered, I receive the following error from Bitrise :

{
  "error": "Failed to transform the webhook: The commit specified by 'checkout_sha' was not included in the 'commits' array - no match found"
}

I found the source code where error is thrown :

	isLastCommitFound := false
	for _, aCommit := range codePushEvent.Commits {
		if aCommit.CommitHash == codePushEvent.CheckoutSHA {
			isLastCommitFound = true
			lastCommit = aCommit
			break
		}
	}

	if !isLastCommitFound {
		return hookCommon.TransformResultModel{
			DontWaitForTriggerResponse: true,
			Error:                      errors.New("The commit specified by 'checkout_sha' was not included in the 'commits' array - no match found"),
		}
	}

Source : gitlab.go

Is there an another way for setting up the incoming webhook ?
Maybe a solution is testing if codePushEvent.Commits is empty before iterating on it ?

Thank's

Sylvain

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

No branches or pull requests

1 participant