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

Commit5ffa6da

Browse files
feat: add inactivity cleanup and failure cleanup configuration fields to Template Schedule Form (#7402)
* added workspace actions entitlement* added workspace actions experiment* added new route for template enterprise meta* removing new route; repurposing old* add new fields to get endpoints* removed workspace actions experiment* added logic to enterprise template store* added new form fields* feature flagged new fields* fix validation* fixed submit btn* fix tests* changed ttl defaults* added FE tests* added BE tests* fixed lint* adjusted comment language* fixing unstaged changes check* fix test* Update coderd/database/migrations/000122_add_template_cleanup_ttls.down.sqlCo-authored-by: Dean Sheather <dean@deansheather.com>* Update coderd/database/migrations/000122_add_template_cleanup_ttls.up.sqlCo-authored-by: Dean Sheather <dean@deansheather.com>---------Co-authored-by: Dean Sheather <dean@deansheather.com>
1 parent3632ac8 commit5ffa6da

File tree

33 files changed

+578
-59
lines changed

33 files changed

+578
-59
lines changed

‎.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"Dsts",
3535
"embeddedpostgres",
3636
"enablements",
37+
"enterprisemeta",
3738
"errgroup",
3839
"eventsourcemock",
3940
"Failf",

‎coderd/apidoc/docs.go

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

‎coderd/apidoc/swagger.json

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

‎coderd/database/dbfake/databasefake.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1945,6 +1945,8 @@ func (q *fakeQuerier) UpdateTemplateScheduleByID(_ context.Context, arg database
19451945
tpl.UpdatedAt=database.Now()
19461946
tpl.DefaultTTL=arg.DefaultTTL
19471947
tpl.MaxTTL=arg.MaxTTL
1948+
tpl.FailureTTL=arg.FailureTTL
1949+
tpl.InactivityTTL=arg.InactivityTTL
19481950
q.templates[idx]=tpl
19491951
returntpl.DeepCopy(),nil
19501952
}

‎coderd/database/dump.sql

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
BEGIN;
2+
ALTERTABLE ONLY templates DROP COLUMN IF EXISTS failure_ttl;
3+
ALTERTABLE ONLY templates DROP COLUMN IF EXISTS inactivity_ttl;
4+
COMMIT;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
BEGIN;
2+
ALTERTABLE ONLY templates ADD COLUMN IF NOT EXISTS failure_ttlBIGINTNOT NULL DEFAULT0;
3+
ALTERTABLE ONLY templates ADD COLUMN IF NOT EXISTS inactivity_ttlBIGINTNOT NULL DEFAULT0;
4+
COMMIT;

‎coderd/database/modelqueries.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ func (q *sqlQuerier) GetAuthorizedTemplates(ctx context.Context, arg GetTemplate
8080
&i.MaxTTL,
8181
&i.AllowUserAutostart,
8282
&i.AllowUserAutostop,
83+
&i.FailureTTL,
84+
&i.InactivityTTL,
8385
);err!=nil {
8486
returnnil,err
8587
}

‎coderd/database/models.go

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/queries.sql.go

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

‎coderd/database/queries/templates.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ SET
118118
allow_user_autostart= $3,
119119
allow_user_autostop= $4,
120120
default_ttl= $5,
121-
max_ttl= $6
121+
max_ttl= $6,
122+
failure_ttl= $7,
123+
inactivity_ttl= $8
122124
WHERE
123125
id= $1
124126
RETURNING

‎coderd/database/sqlc.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ overrides:
5151
template_max_ttl:TemplateMaxTTL
5252
motd_file:MOTDFile
5353
uuid:UUID
54+
failure_ttl:FailureTTL
55+
inactivity_ttl:InactivityTTL
5456

5557
sql:
5658
-schema:"./dump.sql"

‎coderd/schedule/template.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ type TemplateScheduleOptions struct {
1818
//
1919
// If set, users cannot disable automatic workspace shutdown.
2020
MaxTTL time.Duration`json:"max_ttl"`
21+
// If FailureTTL is set, all failed workspaces will be stopped automatically after this time has elapsed.
22+
FailureTTL time.Duration`json:"failure_ttl"`
23+
// If InactivityTTL is set, all inactive workspaces will be deleted automatically after this time has elapsed.
24+
InactivityTTL time.Duration`json:"inactivity_ttl"`
2125
}
2226

2327
// TemplateScheduleStore provides an interface for retrieving template
@@ -47,9 +51,11 @@ func (*agplTemplateScheduleStore) GetTemplateScheduleOptions(ctx context.Context
4751
UserAutostartEnabled:true,
4852
UserAutostopEnabled:true,
4953
DefaultTTL:time.Duration(tpl.DefaultTTL),
50-
// Disregard the value in the database, since MaxTTL is an enterprise
51-
// feature.
52-
MaxTTL:0,
54+
// Disregard the values in the database, since MaxTTL, FailureTTL, and InactivityTTL are enterprise
55+
// features.
56+
MaxTTL:0,
57+
FailureTTL:0,
58+
InactivityTTL:0,
5359
},nil
5460
}
5561

@@ -68,5 +74,7 @@ func (*agplTemplateScheduleStore) SetTemplateScheduleOptions(ctx context.Context
6874
AllowUserAutostart:tpl.AllowUserAutostart,
6975
AllowUserAutostop:tpl.AllowUserAutostop,
7076
MaxTTL:tpl.MaxTTL,
77+
FailureTTL:tpl.FailureTTL,
78+
InactivityTTL:tpl.InactivityTTL,
7179
})
7280
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp