-
Notifications
You must be signed in to change notification settings - Fork 144
feat: support CEL string expressions for custom commit statuses in v1beta3 provider type #1068
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support CEL string expressions for custom commit statuses in v1beta3 provider type #1068
Conversation
46640f1 to
8e37b6a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much for this contribution @kathleenfrench!
First pass 😁 Will do another one tomorrow
a2136b6 to
a37949f
Compare
4eb9403 to
02be262
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work here @kathleenfrench!
0fb250c to
d970b88
Compare
…3 provider types Signed-off-by: kathleen french <kfrench@groq.com>
cb1c0a7 to
1967bc0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thanks very much for this contribution @kathleenfrench! 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @kathleenfrench 🥇

Closes #589
this change was enabled by recent work to enable RFC-0008 which allows for custom metadata to be injected in flux events.
we can leverage the flux runtime pkg
cellibrary's support for compiling and evaluating strings (added in fluxcd/pkg#882) to compute a commit status for git provider types (github,gitlab,gitlea,bitbucketserver,bitbucket, andazuredevops) that can make use of end-user provided event metadata along with standard values accessible toevent,provider, andalert.to accomplish this, a new optional field is added to the
v1beta3providerspec calledcommitStatusExpr.following some additional discussions, it was elected to not re-add the
statussubresource to theproviderto make way for these changes, but instead evaluate the CEL expression from the event server and forward the commit status to the relevant factory, if it exists/is applicable.as part of this effort a few things to note:
ProviderUIDnotifier option has been removed from git providers in favor ofCommitStatus, which is computed prior to creation of the notifier either via the custom expression or using the (status quo) default commit status generator function which combines the involved object kind, name, and provider UID.commitStatusforproviderUID-- error handling + tests have been added to ensure the status cannot be empty on creation of the factory, though this is just a failsafe measure and should not happen given if a custom expression is used and fails we drop the alert and if no custom expression is provided we use the pre-existing logic, just evaluated sooner rather than inPost.combineEventMetadata()prior to creating the notifier nowso to recap: if the commit status expression fails to compile or evaluate we:
log the errorremoved based on pr feedbackemit a warning eventremoved based on pr feedbackif no commit status expression is provided and the provider is a supported git type, we generate a default commit status using event metadata and the provider UID with the same, existing logic just sooner in our handling of the event/alert. if the provider is not a git type, the commit status forwarded to
createNotifieris an empty string.