Repository navigation
Conversation
Add the optional CEL field spec.commitStatusDescriptionExpr to the v1 Provider API. It sets the description of the commit statuses posted by the github, gitlab, gitea, bitbucket, bitbucketserver and azuredevops provider types, while spec.commitStatusExpr sets their context. This allows showing the event message, e.g. the error of a failed health check, on the commit instead of only the event reason. The expression has the same event, alert and provider variables as spec.commitStatusExpr. The result is collapsed to a single line and shortened in the middle to the description limit of the provider type (255 characters for GitLab and Bitbucket Server, 140 for the others), keeping its start and end. An empty result falls back to the default description derived from the event reason. An evaluation error is logged and also falls back to the default description, so that the commit status is still sent. The string output type is checked on evaluation rather than on compilation, as field selections on the event variable such as event.message are of dynamic type. When the field is not set, the commit status is unchanged. Signed-off-by: Steve Lohr <schdief.law@gmail.com> Assisted-by: copilot/claude-opus-5.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1436
Adds the optional field
spec.commitStatusDescriptionExprto the v1 Provider API. It's a CELexpression that sets the description of the commit statuses posted by the
github,gitlab,gitea,bitbucket,bitbucketserverandazuredevopsprovider types. Today the descriptionis always derived from the event reason (e.g.
health check failed), so the actual error isn'tvisible on the commit.
Behaviour:
commitStatusExpr(event,alert,provider). The expression is compiledwithout an output type and
EvaluateStringrejects non-string results, because fieldselections like
event.messageare of typedynand fail the exact output type check inruntime/cel.…to the provider'sdescription limit, keeping its start and end (rune-safe).
commitStatusExpr, the event isn't dropped: the description is informational, and the commitstatus itself is still correct.
commitStatusExpr.Description limits:
githubgitlabbitbucketservergiteaTEXTcolumn); GitHub's value for readabilitybitbucketazuredevopsFor Bitbucket Server, the build status name keeps the reason (
<commitStatus> [<reason>]), asbefore; only the description uses the expression.
Tests cover the shortening, each notifier, CEL cases including the error and non-string
fallbacks, and the CRD validation.
make teststeps pass locally (Go 1.27, envtest 1.37).This is independent of #1434, which also touches
internal/notifier/github.go; whichever mergessecond needs a trivial rebase.