From 7d28f6334544df022bb06605b3b76a8955201755 Mon Sep 17 00:00:00 2001 From: vntw Date: Fri, 26 Nov 2021 13:03:17 +0100 Subject: [PATCH] Fix field type of PipelineEvent.[]Builds.Runner.RunnerType It's documented to be of type string, not bool. For more details see https://github.com/xanzy/go-gitlab/issues/1297 --- event_parsing_webhook_test.go | 4 ++++ event_webhook_types.go | 2 +- testdata/webhooks/pipeline.json | 12 +++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/event_parsing_webhook_test.go b/event_parsing_webhook_test.go index b21f3a156..cf582d550 100644 --- a/event_parsing_webhook_test.go +++ b/event_parsing_webhook_test.go @@ -272,6 +272,10 @@ func TestParsePipelineHook(t *testing.T) { if event.Builds[0].ID != 380 { t.Errorf("Builds[0] ID is %v, want %v", event.Builds[0].ID, 380) } + + if event.Builds[0].Runner.RunnerType != "instance_type" { + t.Errorf("Builds[0] Runner RunnerType is %v, want %v", event.Builds[0].Runner.RunnerType, "instance_type") + } } func TestParsePushHook(t *testing.T) { diff --git a/event_webhook_types.go b/event_webhook_types.go index 5f253e570..1a1405261 100644 --- a/event_webhook_types.go +++ b/event_webhook_types.go @@ -702,7 +702,7 @@ type PipelineEvent struct { Description string `json:"description"` Active bool `json:"active"` IsShared bool `json:"is_shared"` - RunnerType bool `json:"runner_type"` + RunnerType string `json:"runner_type"` Tags []string `json:"tags"` } `json:"runner"` ArtifactsFile struct { diff --git a/testdata/webhooks/pipeline.json b/testdata/webhooks/pipeline.json index f8762ebd3..53b95afb3 100644 --- a/testdata/webhooks/pipeline.json +++ b/testdata/webhooks/pipeline.json @@ -86,7 +86,17 @@ "email": "user1@example.com", "avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon" }, - "runner": null, + "runner": { + "id": 42, + "description": "shared-runners-manager-1.gitlab.com", + "runner_type": "instance_type", + "active": true, + "is_shared": true, + "tags": [ + "docker", + "gce" + ] + }, "artifacts_file":{ "filename": null, "size": null