From e684b5010cf81f5f4fe9a9a853795dc63be0517a Mon Sep 17 00:00:00 2001 From: finkandreas Date: Tue, 4 Jul 2023 22:06:03 +0200 Subject: [PATCH 1/2] Add missing fields to PipelineObjectAttributes Some fields in PipelineObjectAttributes were missing. Reference: https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html#pipeline-events Specifically I am interested in the `IID` field, which is the internal id, and it is the only way to do a GraphQL query for pipelines. It supports only to query by IID. --- gitlab/payload.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gitlab/payload.go b/gitlab/payload.go index 9d668ee..7134d7a 100644 --- a/gitlab/payload.go +++ b/gitlab/payload.go @@ -685,6 +685,8 @@ type ObjectAttributes struct { // PipelineObjectAttributes contains pipeline specific GitLab object attributes information type PipelineObjectAttributes struct { ID int64 `json:"id"` + IID int64 `json:"iid"` + Name string `json:"name"` Ref string `json:"ref"` Tag bool `json:"tag"` SHA string `json:"sha"` @@ -696,6 +698,7 @@ type PipelineObjectAttributes struct { FinishedAt customTime `json:"finished_at"` Duration int64 `json:"duration"` Variables []Variable `json:"variables"` + Url string `json:"url"` } // Variable contains pipeline variables From 674148f62e2276052ce8cefd4d4aced0485f44db Mon Sep 17 00:00:00 2001 From: Andreas Fink Date: Fri, 14 Jul 2023 07:20:26 +0200 Subject: [PATCH 2/2] added fields also to testdata pipeline-event.json --- testdata/gitlab/pipeline-event.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/testdata/gitlab/pipeline-event.json b/testdata/gitlab/pipeline-event.json index 6c93da8..8f87790 100644 --- a/testdata/gitlab/pipeline-event.json +++ b/testdata/gitlab/pipeline-event.json @@ -2,6 +2,8 @@ "object_kind": "pipeline", "object_attributes":{ "id": 31, + "iid": 3, + "name": "pipeline_name", "ref": "master", "tag": false, "sha": "bcbb5ec396a2c0f828686f14fac9b80b780504f2", @@ -21,7 +23,8 @@ "key": "NESTOR_PROD_ENVIRONMENT", "value": "us-west-1" } - ] + ], + "url": "http://192.168.64.1:3005/gitlab-org/gitlab-test/-/pipelines/31" }, "merge_request": { "id": 1,