-
Notifications
You must be signed in to change notification settings - Fork 929
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
b32923a
feat: log resource replacements
dannykopping 0b0830f
feat: show terraform state drift diff in build logs
dannykopping 256395a
feat: only highlight lines which mention replacement
dannykopping 61ef61a
feat: notify template admins when prebuild claim results in resource …
dannykopping a66559f
chore: appease linter
dannykopping 222892b
chore: fix notifications test
dannykopping f34e011
fix: don't panic
dannykopping 5168c01
fix: renaming type
dannykopping 41e5e0c
chore: updating migration numbers
dannykopping b29e8fa
chore: minor touch-ups
dannykopping b31ed5e
feat: add resource replacements metric
dannykopping adf98d2
feat: add resource replacement notification
dannykopping f24aef0
make lint; make fmt
dannykopping 70f9a53
chore: adding tests
dannykopping 1e8385d
feat: pass flag to terraform provider when prebuilt workspace claimed
dannykopping d0f00ce
chore: update provider, add test for is_prebuild_claim
dannykopping 11a2c5a
Merge branch 'main' of github.com:/coder/coder into dk/logreplacements
dannykopping ce63b24
Merge branch 'dk/is-prebuild-claim' of github.com:/coder/coder into d…
dannykopping d2c5d43
chore: replace GetTemplatePresetsByID with GetPresetByID
dannykopping 22d82a4
chore: correcting docs link
dannykopping 5209aae
Merge branch 'main' of github.com:/coder/coder into dk/logreplacement
dannykopping 39ce658
Merge branch 'main' of github.com:/coder/coder into dk/logreplacements
dannykopping ac5655f
Merge branch 'main' of github.com:/coder/coder into dk/logreplacements
dannykopping 82c3f58
chore: note provisioner API change
dannykopping 7577a90
chore: fixups
dannykopping a893b79
chore: adding note about immutable resources
dannykopping d9c906a
chore: review feedback
dannykopping 471198a
Merge branch 'main' of github.com:/coder/coder into dk/logreplacements
dannykopping 7d694e6
chore: merge conflicts
dannykopping 6b7a8b7
chore: fix 'is not iterable' bullshit
dannykopping 5df2cb3
Merge branch 'main' of github.com:/coder/coder into dk/logreplacements
dannykopping 6d1c3ea
chore: rename migrations
dannykopping 5f62702
chore: set notifications manager before enterprise server initializes…
dannykopping f74d799
chore: completing refactor since https://github.com/coder/coder/pull/…
dannykopping 971f65c
chore: remove unnecessary atomicity since map is protected by mutex a…
dannykopping bc362b0
chore: appeasing linter's Very Important Suggestion
dannykopping 4fbd356
Merge branch 'main' of github.com:/coder/coder into dk/logreplacements
dannykopping b9eb8be
chore: remove old replacement logging
dannykopping File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: notify template admins when prebuild claim results in resource …
…replacement(s) Signed-off-by: Danny Kopping <[email protected]>
- Loading branch information
commit 61ef61a213e516bf0b525ba10669c8c8d8ccd55f
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
coderd/database/migrations/000318_resource_replacements_notification.down.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DELETE FROM notification_templates WHERE id = '89d9745a-816e-4695-a17f-3d0a229e2b8d'; |
27 changes: 27 additions & 0 deletions
27
coderd/database/migrations/000318_resource_replacements_notification.up.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
INSERT INTO notification_templates | ||
(id, name, title_template, body_template, "group", actions) | ||
VALUES ('89d9745a-816e-4695-a17f-3d0a229e2b8d', | ||
'Prebuilt Workspace Resource Replaced', | ||
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: | ||
|
||
{{range $resource, $paths := .Data.replacements -}} | ||
- _{{ $resource }}_ was replaced due to changes to _{{ $paths }}_ | ||
{{end}} | ||
|
||
When Terraform must change an immutable attribute, it replaces the entire resource. | ||
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/TODO). | ||
$$, | ||
'Workspace Events', | ||
'[ | ||
{ | ||
"label": "View workspace build", | ||
"url": "{{base_url}}/@{{.Labels.claimant}}/{{.Labels.workspace}}/builds/{{.Labels.workspace_build_num}}" | ||
} | ||
]'::jsonb); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.