Skip to content

Commit 8c707c3

Browse files
ab-ghoshzakisk
authored andcommitted
fix(gitlab): add explicit mapping for cancelled status
- Add case for 'cancelled' conclusion in GitLab provider CreateStatus - Map 'cancelled' to 'canceled' for GitLab API compatibility - Set descriptive title 'cancelled validating this commit' - Ensures proper status reporting when PipelineRuns are cancelled via PR close
1 parent b14b004 commit 8c707c3

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

pkg/provider/gitlab/gitlab.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,9 @@ func (v *Provider) CreateStatus(_ context.Context, event *info.Event, statusOpts
263263
case "neutral":
264264
statusOpts.Conclusion = "canceled"
265265
statusOpts.Title = "stopped"
266+
case "cancelled":
267+
statusOpts.Conclusion = "canceled"
268+
statusOpts.Title = "cancelled validating this commit"
266269
case "failure":
267270
statusOpts.Conclusion = "failed"
268271
statusOpts.Title = "failed"

pkg/provider/gitlab/gitlab_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,20 @@ func TestCreateStatus(t *testing.T) {
142142
postStr: "has completed",
143143
},
144144
},
145+
{
146+
name: "cancelled conclusion",
147+
wantClient: true,
148+
wantErr: false,
149+
args: args{
150+
statusOpts: provider.StatusOpts{
151+
Conclusion: "cancelled",
152+
},
153+
event: &info.Event{
154+
TriggerTarget: "pull_request",
155+
},
156+
postStr: "has cancelled",
157+
},
158+
},
145159
{
146160
name: "gitops comments completed",
147161
wantClient: true,

0 commit comments

Comments
 (0)