- Notifications
You must be signed in to change notification settings - Fork1.1k
feat: track resource replacements when claiming a prebuilt workspace#17571
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
b32923a0b0830f256395a61ef61aa66559f222892bf34e0115168c0141e5e0cb29e8fab31ed5eadf98d2f24aef070f9a531e8385dd0f00ce11a2c5ace63b24d2c5d4322d82a45209aae39ce658ac5655f82c3f587577a90a893b79d9c906a471198a7d694e66b7a8b75df2cb36d1c3ea5f62702f74d799971f65cbc362b04fbd356b9eb8beFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
Signed-off-by: Danny Kopping <dannykopping@gmail.com>
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -2524,6 +2524,13 @@ func (q *querier) GetTemplateParameterInsights(ctx context.Context, arg database | ||
| return q.db.GetTemplateParameterInsights(ctx, arg) | ||
| } | ||
| func (q *querier) GetTemplatePresetsByID(ctx context.Context, id uuid.UUID) (database.TemplateVersionPreset, error) { | ||
| if err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceTemplate.All()); err != nil { | ||
dannykopping marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| return database.TemplateVersionPreset{}, err | ||
| } | ||
| return q.db.GetTemplatePresetsByID(ctx, id) | ||
| } | ||
| func (q *querier) GetTemplatePresetsWithPrebuilds(ctx context.Context, templateID uuid.NullUUID) ([]database.GetTemplatePresetsWithPrebuildsRow, error) { | ||
| // GetTemplatePresetsWithPrebuilds retrieves template versions with configured presets and prebuilds. | ||
| // Presets and prebuilds are part of the template, so if you can access templates - you can access them as well. | ||
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -5,6 +5,7 @@ VALUES ('89d9745a-816e-4695-a17f-3d0a229e2b8d', | ||
| E'There might be a problem with a recently claimed prebuilt workspace', | ||
| $$ | ||
| Workspace **{{.Labels.workspace}}** was claimed from a prebuilt workspace by **{{.Labels.claimant}}**. | ||
| During the claim, Terraform destroyed and recreated the following resources | ||
| because one or more immutable attributes changed: | ||
mafredri marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| @@ -16,12 +17,18 @@ When Terraform must change an immutable attribute, it replaces the entire resour | ||
| If you’re using prebuilds to speed up provisioning, unexpected replacements will slow down | ||
| workspace startup—even when claiming a prebuilt environment. | ||
| For tips on preventing replacements and improving claim performance, see [this guide](https://coder.com/docs/admin/templates/extending-templates/prebuilt-workspaces.md#preventing-resource-replacement). | ||
dannykopping marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| NOTE: this prebuilt workspace used the **{{.Labels.preset}}** preset. | ||
| $$, | ||
| 'Template Events', | ||
| '[ | ||
| { | ||
| "label": "View workspace build", | ||
| "url": "{{base_url}}/@{{.Labels.claimant}}/{{.Labels.workspace}}/builds/{{.Labels.workspace_build_num}}" | ||
| }, | ||
| { | ||
| "label": "View template version", | ||
| "url": "{{base_url}}/templates/{{.Labels.org}}/{{.Labels.template}}/versions/{{.Labels.template_version}}" | ||
| } | ||
| ]'::jsonb); | ||
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -42,6 +42,11 @@ FROM templates t | ||
| WHERE tvp.desired_instances IS NOT NULL -- Consider only presets that have a prebuild configuration. | ||
| AND (t.id = sqlc.narg('template_id')::uuid OR sqlc.narg('template_id') IS NULL); | ||
| -- name: GetTemplatePresetsByID :one | ||
dannykopping marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| SELECT * | ||
| FROM template_version_presets | ||
| WHERE id = $1; | ||
| -- name: GetRunningPrebuiltWorkspaces :many | ||
| SELECT | ||
| p.id, | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -50,7 +50,7 @@ type StoreEnqueuer struct { | ||
| } | ||
| // NewStoreEnqueuer creates an Enqueuer implementation which can persist notification messages in the store. | ||
| func NewStoreEnqueuer(cfg codersdk.NotificationsConfig, store Store, helpers template.FuncMap, log slog.Logger, clock quartz.Clock) (Enqueuer, error) { | ||
| var method database.NotificationMethod | ||
| // TODO(DanielleMaywood): | ||
| // Currently we do not want to allow setting `inbox` as the default notification method. | ||
| @@ -203,7 +203,7 @@ func (s *StoreEnqueuer) buildPayload(metadata database.FetchNewMessageMetadataRo | ||
| type NoopEnqueuer struct{} | ||
| // NewNoopEnqueuer builds a NoopEnqueuer which is used to fulfill the contract for enqueuing notifications, if ExperimentNotifications is not set. | ||
| func NewNoopEnqueuer()Enqueuer { | ||
mafredri marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| return &NoopEnqueuer{} | ||
| } | ||
Uh oh!
There was an error while loading.Please reload this page.