-
Notifications
You must be signed in to change notification settings - Fork 157
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
[WaitApproval Plugin] Add NotifyEvent methods #5613
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: t-kikuc <[email protected]>
Signed-off-by: t-kikuc <[email protected]>
Signed-off-by: t-kikuc <[email protected]>
Signed-off-by: t-kikuc <[email protected]>
Signed-off-by: t-kikuc <[email protected]>
Signed-off-by: t-kikuc <[email protected]>
Signed-off-by: t-kikuc <[email protected]>
Signed-off-by: t-kikuc <[email protected]>
Signed-off-by: t-kikuc <[email protected]>
func getMentionTargets(ctx context.Context, e model.NotificationEventType, deploymentID string, msr *metadatastore.MetadataStoreRegistry) (users []string, groups []string, err error) { | ||
n, err := msr.GetDeploymentSharedMetadata(ctx, &service.GetDeploymentSharedMetadataRequest{ | ||
DeploymentId: deploymentID, | ||
Key: model.MetadataKeyDeploymentNotification, | ||
}) | ||
if err != nil { | ||
return []string{}, []string{}, err | ||
} | ||
if !n.Found { | ||
return []string{}, []string{}, nil | ||
} | ||
|
||
var notif config.DeploymentNotification | ||
if err := json.Unmarshal([]byte(n.Value), ¬if); err != nil { | ||
return nil, nil, fmt.Errorf("could not extract mentions users and groups config: %w", err) | ||
} | ||
|
||
return notif.FindSlackUsers(e), notif.FindSlackGroups(e), 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.
I referred to here:
pipecd/pkg/app/piped/executor/waitapproval/waitapproval.go
Lines 145 to 158 in 93e9a27
// getMentionedUsers returns the list of users groups who should be mentioned in the notification. | |
func (e *Executor) getApplicationNotificationMentions(event model.NotificationEventType) ([]string, []string, error) { | |
n, ok := e.MetadataStore.Shared().Get(model.MetadataKeyDeploymentNotification) | |
if !ok { | |
return []string{}, []string{}, nil | |
} | |
var notification config.DeploymentNotification | |
if err := json.Unmarshal([]byte(n), ¬ification); err != nil { | |
return nil, nil, fmt.Errorf("could not extract mentions users and groups config: %w", err) | |
} | |
return notification.FindSlackUsers(event), notification.FindSlackGroups(event), nil | |
} |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5613 +/- ##
==========================================
- Coverage 26.58% 26.55% -0.04%
==========================================
Files 474 474
Lines 50546 50614 +68
==========================================
+ Hits 13438 13439 +1
- Misses 36045 36112 +67
Partials 1063 1063 ☔ View full report in Codecov by Sentry. |
What this PR does:
I implemented NotifyEvent methods in both piped and plugin side.
Why we need it:
The WaitApproval plugin needs to:
NotificationEventDeploymentWaitApproval
)NotificationEventDeploymentApproved
)cf.
pipecd/pkg/app/piped/executor/waitapproval/waitapproval.go
Lines 112 to 143 in 2ce020e
Which issue(s) this PR fixes:
Part of #5367
Does this PR introduce a user-facing change?: