Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitab90612

Browse files
temporary commit
1 parent1d51dfc commitab90612

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

‎enterprise/coderd/prebuilds/reconcile.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,49 @@ func (c *StoreReconciler) ReconcilePreset(ctx context.Context, ps prebuilds.Pres
363363

364364
ifps.IsHardLimited {
365365
logger.Debug(ctx,"skipping hard limited preset",slog.F("preset_id",ps.Preset.ID),slog.F("name",ps.Preset.Name))
366+
367+
// TODO(yevhenii): move into separate func
368+
// TODO(yevhenii): finish it
369+
// Send notification to template admins.
370+
ifc.notifEnq==nil {
371+
c.logger.Warn(ctx,"notification enqueuer not set, cannot send resource replacement notification(s)")
372+
returnnil
373+
}
374+
375+
templateAdmins,err:=c.store.GetUsers(ctx, database.GetUsersParams{
376+
RbacRole: []string{codersdk.RoleTemplateAdmin},
377+
})
378+
iferr!=nil {
379+
returnxerrors.Errorf("fetch template admins: %w",err)
380+
}
381+
382+
for_,templateAdmin:=rangetemplateAdmins {
383+
if_,err:=c.notifEnq.EnqueueWithData(ctx,templateAdmin.ID,notifications.TemplateWorkspaceResourceReplaced,
384+
map[string]string{
385+
//"org": org.Name,
386+
//"workspace": workspace.Name,
387+
//"template": workspace.TemplateName,
388+
//"template_version": templateVersion.Name,
389+
//"preset": prebuildPreset.Name,
390+
//"workspace_build_num": fmt.Sprintf("%d", build.BuildNumber),
391+
//"claimant": claimant.Username,
392+
},
393+
map[string]any{
394+
//"replacements": repls,
395+
},"prebuilds_reconciler",
396+
// Associate this notification with all the related entities.
397+
//workspace.ID, workspace.OwnerID, workspace.TemplateID, templateVersion.ID, prebuildPreset.ID, workspace.OrganizationID,
398+
);err!=nil {
399+
c.logger.Error(ctx,
400+
"failed to send notification",
401+
slog.Error(err),
402+
slog.F("template_admin_id",templateAdmin.ID.String()),
403+
)
404+
405+
continue
406+
}
407+
}
408+
366409
returnnil
367410
}
368411

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp