diff --git a/api/build/skip.go b/api/build/skip.go index 2d934fb93..0987e99f6 100644 --- a/api/build/skip.go +++ b/api/build/skip.go @@ -13,25 +13,25 @@ import ( func SkipEmptyBuild(p *pipeline.Build) string { if len(p.Stages) == 1 { if p.Stages[0].Name == "init" { - return "skipping build since only init stage found" + return "skipping build since only init stage found — it is likely no rulesets matched for the webhook payload" } } if len(p.Stages) == 2 { if p.Stages[0].Name == "init" && p.Stages[1].Name == "clone" { - return "skipping build since only init and clone stages found" + return "skipping build since only init and clone stages found — it is likely no rulesets matched for the webhook payload" } } if len(p.Steps) == 1 { if p.Steps[0].Name == "init" { - return "skipping build since only init step found" + return "skipping build since only init step found — it is likely no rulesets matched for the webhook payload" } } if len(p.Steps) == 2 { if p.Steps[0].Name == "init" && p.Steps[1].Name == "clone" { - return "skipping build since only init and clone steps found" + return "skipping build since only init and clone steps found — it is likely no rulesets matched for the webhook payload" } } diff --git a/api/build/skip_test.go b/api/build/skip_test.go index 27cf416bd..f55163227 100644 --- a/api/build/skip_test.go +++ b/api/build/skip_test.go @@ -22,7 +22,7 @@ func Test_SkipEmptyBuild(t *testing.T) { { Name: "init", }, - }}}, "skipping build since only init stage found"}, + }}}, "skipping build since only init stage found — it is likely no rulesets matched for the webhook payload"}, {"init and clone stages", args{p: &pipeline.Build{Stages: []*pipeline.Stage{ { Name: "init", @@ -30,7 +30,7 @@ func Test_SkipEmptyBuild(t *testing.T) { { Name: "clone", }, - }}}, "skipping build since only init and clone stages found"}, + }}}, "skipping build since only init and clone stages found — it is likely no rulesets matched for the webhook payload"}, {"three stages", args{p: &pipeline.Build{Stages: []*pipeline.Stage{ { Name: "init", @@ -46,7 +46,7 @@ func Test_SkipEmptyBuild(t *testing.T) { { Name: "init", }, - }}}, "skipping build since only init step found"}, + }}}, "skipping build since only init step found — it is likely no rulesets matched for the webhook payload"}, {"init and clone steps", args{p: &pipeline.Build{Steps: []*pipeline.Container{ { Name: "init", @@ -54,7 +54,7 @@ func Test_SkipEmptyBuild(t *testing.T) { { Name: "clone", }, - }}}, "skipping build since only init and clone steps found"}, + }}}, "skipping build since only init and clone steps found — it is likely no rulesets matched for the webhook payload"}, {"three steps", args{p: &pipeline.Build{Steps: []*pipeline.Container{ { Name: "init", diff --git a/api/webhook/post.go b/api/webhook/post.go index aa4449194..47562f80f 100644 --- a/api/webhook/post.go +++ b/api/webhook/post.go @@ -532,6 +532,10 @@ func PostWebhook(c *gin.Context) { // set build to successful status b.SetStatus(constants.StatusSkipped) + // set hook status and message + h.SetStatus(constants.StatusSkipped) + h.SetError(skip) + // send API call to set the status on the commit err = scm.FromContext(c).Status(ctx, u, b, repo.GetOrg(), repo.GetName()) if err != nil {