-
Notifications
You must be signed in to change notification settings - Fork 889
fix: reduce cost of prebuild failure #17697
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
Changes from all commits
fcb3e5d
701e2a8
0fdd096
13c0e28
29e9cff
1d51dfc
5c60065
b0248c3
08b18b0
0fd347a
08981a4
0e4600c
107879b
2dea5ab
e252093
906ceb9
3a0284f
13fb1af
108ea0a
7cd2799
f9148e2
315acfa
1679ac9
d9c9d17
c47ddaa
c19f28a
b18730f
37173b0
0e3cc40
784adba
50bd9b4
8a33ac8
9439fa1
e667dad
8a51702
a793e18
a0fb69c
c6f209c
9dccf3e
c19ae04
4b145cc
80f3677
2144d13
79725b3
7e8b4b6
ab5acfb
7c09465
b7a34c5
e1e141d
354aeb4
7564178
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DELETE FROM notification_templates WHERE id = '414d9331-c1fc-4761-b40c-d1f4702279eb'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
INSERT INTO notification_templates | ||
(id, name, title_template, body_template, "group", actions) | ||
VALUES ('414d9331-c1fc-4761-b40c-d1f4702279eb', | ||
'Prebuild Failure Limit Reached', | ||
E'There is a problem creating prebuilt workspaces', | ||
$$ | ||
The number of failed prebuild attempts has reached the hard limit for template **{{ .Labels.template }}** and preset **{{ .Labels.preset }}**. | ||
|
||
To resume prebuilds, fix the underlying issue and upload a new template version. | ||
dannykopping marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Refer to the documentation for more details: | ||
- [Troubleshooting templates](https://coder.com/docs/admin/templates/troubleshooting) | ||
- [Troubleshooting of prebuilt workspaces](https://coder.com/docs/admin/templates/extending-templates/prebuilt-workspaces#administration-and-troubleshooting) | ||
$$, | ||
'Template Events', | ||
'[ | ||
{ | ||
"label": "View failed prebuilt workspaces", | ||
"url": "{{base_url}}/workspaces?filter=owner:prebuilds+status:failed+template:{{.Labels.template}}" | ||
}, | ||
{ | ||
"label": "View template version", | ||
"url": "{{base_url}}/templates/{{.Labels.org}}/{{.Labels.template}}/versions/{{.Labels.template_version}}" | ||
} | ||
]'::jsonb); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- Remove the column from the table first (must happen before dropping the enum type) | ||
ALTER TABLE template_version_presets DROP COLUMN prebuild_status; | ||
|
||
-- Then drop the enum type | ||
DROP TYPE prebuild_status; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CREATE TYPE prebuild_status AS ENUM ( | ||
'healthy', -- Prebuilds are working as expected; this is the default, healthy state. | ||
'hard_limited', -- Prebuilds have failed repeatedly and hit the configured hard failure limit; won't be retried anymore. | ||
dannykopping marked this conversation as resolved.
Show resolved
Hide resolved
|
||
'validation_failed' -- Prebuilds failed due to a non-retryable validation error (e.g. template misconfiguration); won't be retried. | ||
); | ||
|
||
ALTER TABLE template_version_presets ADD COLUMN prebuild_status prebuild_status NOT NULL DEFAULT 'healthy'::prebuild_status; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 still think "insights" is a weird auth context to use here.
Why did we choose this again @SasSwart?
Uh oh!
There was an error while loading. Please reload this page.
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.
@dannykopping
Basically we have 3 actions:
Read
Template.All()Use
Template.All()ViewInsights
Template.All()Read
is for reading the content of templateUse
is for creating workspacesViewInsights
is for gathering stats & metrics across templatesLooks like
GetPresetsBackoff
falls intoViewInsights
category - because we gathering statistics across all template presets, calculating number of failed builds, etc...I had a discussion with Steven regarding this, but I'm open to suggestions.
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.
Repurposing other RBAC roles just because they overlap logically feels like a bad design choice.
Each feature should have its own RBAC policy.
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.
We can introduce
new resource type
here: https://github.com/coder/coder/blob/main/coderd/rbac/object_gen.goThen use it like this:
Optionally introduce new
action type
as well, and use it like this:But I think we don't want to introduce too many action types.
cc @Emyrk
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.
We can do this in a follow-up, by the way 👍
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 don't have all the context for prebuilds. Can we throw a quick disc chat on the calendar?