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

Commitd5f828e

Browse files
committed
chore: remove max_ttl from templates
Completely removing max_ttl as a feature on template scheduling
1 parentcf50461 commitd5f828e

File tree

24 files changed

+103
-216
lines changed

24 files changed

+103
-216
lines changed

‎cli/templateedit.go

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ func (r *RootCmd) templateEdit() *serpent.Command {
2424
iconstring
2525
defaultTTL time.Duration
2626
activityBump time.Duration
27-
maxTTL time.Duration
2827
autostopRequirementDaysOfWeek []string
2928
autostopRequirementWeeksint64
3029
autostartRequirementDaysOfWeek []string
@@ -53,7 +52,6 @@ func (r *RootCmd) templateEdit() *serpent.Command {
5352
autostopRequirementWeeks>0||
5453
!allowUserAutostart||
5554
!allowUserAutostop||
56-
maxTTL!=0||
5755
failureTTL!=0||
5856
dormancyThreshold!=0||
5957
dormancyAutoDeletion!=0||
@@ -69,7 +67,7 @@ func (r *RootCmd) templateEdit() *serpent.Command {
6967
}
7068

7169
ifrequiresScheduling&&!entitlements.Features[codersdk.FeatureAdvancedTemplateScheduling].Enabled {
72-
returnxerrors.Errorf("your license is not entitled to use advanced template scheduling, so you cannot set --max-ttl, --failure-ttl, --inactivityTTL, --allow-user-autostart=false or --allow-user-autostop=false")
70+
returnxerrors.Errorf("your license is not entitled to use advanced template scheduling, so you cannot set --failure-ttl, --inactivityTTL, --allow-user-autostart=false or --allow-user-autostop=false")
7371
}
7472

7573
ifrequireActiveVersion {
@@ -101,10 +99,6 @@ func (r *RootCmd) templateEdit() *serpent.Command {
10199
displayName=template.DisplayName
102100
}
103101

104-
if!userSetOption(inv,"max-ttl") {
105-
maxTTL=time.Duration(template.MaxTTLMillis)*time.Millisecond
106-
}
107-
108102
if!userSetOption(inv,"default-ttl") {
109103
defaultTTL=time.Duration(template.DefaultTTLMillis)*time.Millisecond
110104
}
@@ -179,7 +173,6 @@ func (r *RootCmd) templateEdit() *serpent.Command {
179173
Icon:icon,
180174
DefaultTTLMillis:defaultTTL.Milliseconds(),
181175
ActivityBumpMillis:activityBump.Milliseconds(),
182-
MaxTTLMillis:maxTTL.Milliseconds(),
183176
AutostopRequirement:&codersdk.TemplateAutostopRequirement{
184177
DaysOfWeek:autostopRequirementDaysOfWeek,
185178
Weeks:autostopRequirementWeeks,
@@ -244,11 +237,6 @@ func (r *RootCmd) templateEdit() *serpent.Command {
244237
Description:"Edit the template activity bump - workspaces created from this template will have their shutdown time bumped by this value when activity is detected. Maps to\"Activity bump\" in the UI.",
245238
Value:serpent.DurationOf(&activityBump),
246239
},
247-
{
248-
Flag:"max-ttl",
249-
Description:"Edit the template maximum time before shutdown - workspaces created from this template must shutdown within the given duration after starting, regardless of user activity. This is an enterprise-only feature. Maps to\"Max lifetime\" in the UI.",
250-
Value:serpent.DurationOf(&maxTTL),
251-
},
252240
{
253241
Flag:"autostart-requirement-weekdays",
254242
// workspaces created from this template must be restarted on the given weekdays. To unset this value for the template (and disable the autostop requirement for the template), pass 'none'.
@@ -268,8 +256,6 @@ func (r *RootCmd) templateEdit() *serpent.Command {
268256
{
269257
Flag:"autostop-requirement-weekdays",
270258
Description:"Edit the template autostop requirement weekdays - workspaces created from this template must be restarted on the given weekdays. To unset this value for the template (and disable the autostop requirement for the template), pass 'none'.",
271-
// TODO(@dean): unhide when we delete max_ttl
272-
Hidden:true,
273259
Value:serpent.Validate(serpent.StringArrayOf(&autostopRequirementDaysOfWeek),func(value*serpent.StringArray)error {
274260
v:=value.GetSlice()
275261
iflen(v)==1&&v[0]=="none" {
@@ -285,9 +271,7 @@ func (r *RootCmd) templateEdit() *serpent.Command {
285271
{
286272
Flag:"autostop-requirement-weeks",
287273
Description:"Edit the template autostop requirement weeks - workspaces created from this template must be restarted on an n-weekly basis.",
288-
// TODO(@dean): unhide when we delete max_ttl
289-
Hidden:true,
290-
Value:serpent.Int64Of(&autostopRequirementWeeks),
274+
Value:serpent.Int64Of(&autostopRequirementWeeks),
291275
},
292276
{
293277
Flag:"failure-ttl",

‎coderd/apidoc/docs.go

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/apidoc/swagger.json

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/dbmem/dbmem.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6958,8 +6958,6 @@ func (q *FakeQuerier) UpdateTemplateScheduleByID(_ context.Context, arg database
69586958
tpl.UpdatedAt=dbtime.Now()
69596959
tpl.DefaultTTL=arg.DefaultTTL
69606960
tpl.ActivityBump=arg.ActivityBump
6961-
tpl.UseMaxTtl=arg.UseMaxTtl
6962-
tpl.MaxTTL=arg.MaxTTL
69636961
tpl.AutostopRequirementDaysOfWeek=arg.AutostopRequirementDaysOfWeek
69646962
tpl.AutostopRequirementWeeks=arg.AutostopRequirementWeeks
69656963
tpl.AutostartBlockDaysOfWeek=arg.AutostartBlockDaysOfWeek

‎coderd/database/dump.sql

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
-- Update the template_with_users view by recreating it.
2+
DROPVIEW template_with_users;
3+
4+
ALTERTABLE"templates" ADD COLUMN"max_ttl"bigint DEFAULT'0'::bigintNOT NULL;
5+
-- Most templates should have this set to false by now.
6+
ALTERTABLE templates ADD COLUMN use_max_ttlbooleanNOT NULL DEFAULT false;
7+
8+
CREATE VIEW
9+
template_with_users
10+
AS
11+
SELECT
12+
templates.*,
13+
coalesce(visible_users.avatar_url,'')AS created_by_avatar_url,
14+
coalesce(visible_users.username,'')AS created_by_username
15+
FROM
16+
templates
17+
LEFT JOIN
18+
visible_users
19+
ON
20+
templates.created_by=visible_users.id;
21+
COMMENT ON VIEW template_with_users IS'Joins in the username + avatar url of the created by user.';
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
-- Update the template_with_users view by recreating it.
2+
DROPVIEW template_with_users;
3+
4+
ALTERTABLE templates DROP COLUMN"max_ttl";
5+
ALTERTABLE templates DROP COLUMN"use_max_ttl";
6+
7+
CREATE VIEW
8+
template_with_users
9+
AS
10+
SELECT
11+
templates.*,
12+
coalesce(visible_users.avatar_url,'')AS created_by_avatar_url,
13+
coalesce(visible_users.username,'')AS created_by_username
14+
FROM
15+
templates
16+
LEFT JOIN
17+
visible_users
18+
ON
19+
templates.created_by=visible_users.id;
20+
COMMENT ON VIEW template_with_users IS'Joins in the username + avatar url of the created by user.';

‎coderd/database/modelqueries.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ func (q *sqlQuerier) GetAuthorizedTemplates(ctx context.Context, arg GetTemplate
7878
&i.GroupACL,
7979
&i.DisplayName,
8080
&i.AllowUserCancelWorkspaceJobs,
81-
&i.MaxTTL,
8281
&i.AllowUserAutostart,
8382
&i.AllowUserAutostop,
8483
&i.FailureTTL,
@@ -89,7 +88,6 @@ func (q *sqlQuerier) GetAuthorizedTemplates(ctx context.Context, arg GetTemplate
8988
&i.AutostartBlockDaysOfWeek,
9089
&i.RequireActiveVersion,
9190
&i.Deprecated,
92-
&i.UseMaxTtl,
9391
&i.ActivityBump,
9492
&i.MaxPortSharingLevel,
9593
&i.CreatedByAvatarURL,

‎coderd/database/models.go

Lines changed: 1 addition & 5 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp