-
Notifications
You must be signed in to change notification settings - Fork 168
feat(#896): store notification status in workflowrun #897
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
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Assign the PR to them by writing The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
LGTM |
// sendNotifications send notifications for workflowruns when: | ||
// * its workflow has notification config | ||
// * finish time after workflow controller starts | ||
// * notification status of workflowrun is not nil |
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.
notification status of workflowrun is nil
?
// * notification status of workflowrun is not nil | ||
// If the returned notification status is nil, it means that there is no need to send notification. | ||
func (h *Handler) sendNotifications(wfr *v1alpha1.WorkflowRun) (map[string]v1alpha1.NotificationStatus, error) { | ||
// No need to send notifications for workflowruns finished before workflow controller starts. |
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.
Doesn't describe all the conditions in the if clause.
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.
Remove this, have included in method comments.
return err | ||
} | ||
|
||
if !reflect.DeepEqual(latest.Status.Notifications, status) { |
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.
Does latest.Status.Notifications == nil
suffices ?
// If the returned notification status is nil, it means that there is no need to send notification. | ||
func (h *Handler) sendNotifications(wfr *v1alpha1.WorkflowRun) (map[string]v1alpha1.NotificationStatus, error) { | ||
// No need to send notifications for workflowruns finished before workflow controller starts. | ||
if wfr.Spec.WorkflowRef == nil || wfr.Status.Notifications != nil || |
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.
wfr.Spec.WorkflowRef == nil
is an abnormal condition, I think we should report error instead of keep silent
/lgtm |
ab38b82
to
bcd9ea7
Compare
/lgtm |
What this PR does / why we need it:
Add your description
Which issue(s) this PR is related to (optional, link to 3rd issue(s)):
Fixes #896
Reference to #
Special notes for your reviewer:
/cc @zhujian7 @cd1989
Release note: