Skip to content

Commit

Permalink
enhance: add a status call for failed compilation (#1178)
Browse files Browse the repository at this point in the history
  • Loading branch information
ecrupper authored Sep 11, 2024
1 parent e0c2f7e commit 6750763
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions api/webhook/post.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,15 @@ func PostWebhook(c *gin.Context) {
h.SetStatus(constants.StatusFailure)
h.SetError(err.Error())

b.SetStatus(constants.StatusError)

util.HandleError(c, code, err)

err = scm.FromContext(c).Status(ctx, repo.GetOwner(), b, repo.GetOrg(), repo.GetName())
if err != nil {
l.Debugf("unable to set commit status for %s/%d: %v", repo.GetFullName(), b.GetNumber(), err)
}

return
}

Expand Down
9 changes: 8 additions & 1 deletion scm/github/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,14 @@ func (c *client) Status(ctx context.Context, u *api.User, b *api.Build, org, nam
description = "build was skipped as no steps/stages found"
default:
state = "error"
description = "there was an error"

// if there is no build, then this status update is from a failed compilation
if b.GetID() == 0 {
description = "error compiling pipeline - check audit for more information"
url = fmt.Sprintf("%s/%s/%s/hooks", c.config.WebUIAddress, org, name)
} else {
description = "there was an error"
}
}

// check if the build event is deployment
Expand Down

0 comments on commit 6750763

Please sign in to comment.