Fix Gitlab trigger payload bug when commits is empty
Gitlab will occasionally send trigger payloads with an empty commit list (and a null checkout_ha) for branches that have been deleted. Properly handle that case.
This commit is contained in:
parent
b4dd5ea4dd
commit
c43173576a
3 changed files with 66 additions and 3 deletions
44
test/triggerjson/gitlab_webhook_nocommit.json
Normal file
44
test/triggerjson/gitlab_webhook_nocommit.json
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"object_kind": "push",
|
||||
"event_name": "push",
|
||||
"before": "cc66287314cb154c986665a6c29377ef42edee60",
|
||||
"after": "0000000000000000000000000000000000000000",
|
||||
"ref": "refs\/heads\/foobar",
|
||||
"checkout_sha": null,
|
||||
"message": null,
|
||||
"user_id": 750047,
|
||||
"user_name": "Joseph Schorr",
|
||||
"user_email": "joseph.schorr@coreos.com",
|
||||
"user_avatar": "https:\/\/secure.gravatar.com\/avatar\/63e4521c07d2312d8e20c3a6cad36f57?s=80&d=identicon",
|
||||
"project_id": 1756744,
|
||||
"project": {
|
||||
"name": "some-test-project",
|
||||
"description": "",
|
||||
"web_url": "https:\/\/gitlab.com\/joseph.schorr\/some-test-project",
|
||||
"avatar_url": null,
|
||||
"git_ssh_url": "git@gitlab.com:joseph.schorr\/some-test-project.git",
|
||||
"git_http_url": "https:\/\/gitlab.com\/joseph.schorr\/some-test-project.git",
|
||||
"namespace": "joseph.schorr",
|
||||
"visibility_level": 0,
|
||||
"path_with_namespace": "joseph.schorr\/some-test-project",
|
||||
"default_branch": "master",
|
||||
"homepage": "https:\/\/gitlab.com\/joseph.schorr\/some-test-project",
|
||||
"url": "git@gitlab.com:joseph.schorr\/some-test-project.git",
|
||||
"ssh_url": "git@gitlab.com:joseph.schorr\/some-test-project.git",
|
||||
"http_url": "https:\/\/gitlab.com\/joseph.schorr\/some-test-project.git"
|
||||
},
|
||||
"commits": [
|
||||
|
||||
],
|
||||
"total_commits_count": 0,
|
||||
"repository": {
|
||||
"name": "some-test-project",
|
||||
"url": "git@gitlab.com:joseph.schorr\/some-test-project.git",
|
||||
"description": "",
|
||||
"homepage": "https:\/\/gitlab.com\/joseph.schorr\/some-test-project",
|
||||
"git_http_url": "https:\/\/gitlab.com\/joseph.schorr\/some-test-project.git",
|
||||
"git_ssh_url": "git@gitlab.com:joseph.schorr\/some-test-project.git",
|
||||
"visibility_level": 0
|
||||
}
|
||||
}
|
||||
|
Reference in a new issue