Skip to content

Push event from Gitlab wihout new commit cause error #182

Open
@sylvainp

Description

@sylvainp

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions