From f248671aae807b954c2074e063fac1030917b1b7 Mon Sep 17 00:00:00 2001 From: Anton Krivenko Date: Sat, 28 Sep 2019 23:17:57 +0300 Subject: [PATCH] Fixed pipeline hook for GitLab >= 12.3 --- gitlab/payload.go | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/gitlab/payload.go b/gitlab/payload.go index 680a741..c2c2b8a 100644 --- a/gitlab/payload.go +++ b/gitlab/payload.go @@ -104,12 +104,12 @@ type WikiPageEventPayload struct { // PipelineEventPayload contains the information for GitLab's pipeline status change event type PipelineEventPayload struct { - ObjectKind string `json:"object_kind"` - User User `json:"user"` - Project Project `json:"project"` - Commit Commit `json:"commit"` - ObjectAttributes ObjectAttributes `json:"object_attributes"` - Jobs []Job `json:"jobs"` + ObjectKind string `json:"object_kind"` + User User `json:"user"` + Project Project `json:"project"` + Commit Commit `json:"commit"` + ObjectAttributes PipelineObjectAttributes `json:"object_attributes"` + Jobs []Job `json:"jobs"` } // CommentEventPayload contains the information for GitLab's comment event @@ -356,6 +356,21 @@ type ObjectAttributes struct { Assignee Assignee `json:"assignee"` } +// PipelineObjectAttributes contains pipeline specific GitLab object attributes information +type PipelineObjectAttributes struct { + ID int64 `json:"id"` + Ref string `json:"ref"` + Tag bool `json:"tag"` + SHA string `json:"sha"` + BeforeSHA string `json:"before_sha"` + Source string `json:"source"` + Status string `json:"status"` + Stages []string `json:"stages"` + CreatedAt customTime `json:"created_at"` + FinishedAt customTime `json:"finished_at"` + Duration int64 `json:"duration"` +} + // Position defines a specific location, identified by paths line numbers and // image coordinates, within a specific diff, identified by start, head and // base commit ids.