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

Commitece35cf

Browse files
committed
Merge branch 'main' into icons-page
2 parents79ef7a8 +71ad590 commitece35cf

File tree

92 files changed

+2152
-729
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+2152
-729
lines changed

‎cli/create.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ func (r *RootCmd) create() *clibase.Cmd {
2727
workspaceNamestring
2828

2929
parameterFlagsworkspaceParameterFlags
30+
autoUpdatesstring
3031
)
3132
client:=new(codersdk.Client)
3233
cmd:=&clibase.Cmd{
@@ -169,6 +170,7 @@ func (r *RootCmd) create() *clibase.Cmd {
169170
AutostartSchedule:schedSpec,
170171
TTLMillis:ttlMillis,
171172
RichParameterValues:richParameters,
173+
AutomaticUpdates:codersdk.AutomaticUpdates(autoUpdates),
172174
})
173175
iferr!=nil {
174176
returnxerrors.Errorf("create workspace: %w",err)
@@ -208,6 +210,13 @@ func (r *RootCmd) create() *clibase.Cmd {
208210
Description:"Specify a duration after which the workspace should shut down (e.g. 8h).",
209211
Value:clibase.DurationOf(&stopAfter),
210212
},
213+
clibase.Option{
214+
Flag:"automatic-updates",
215+
Env:"CODER_WORKSPACE_AUTOMATIC_UPDATES",
216+
Description:"Specify automatic updates setting for the workspace (accepts 'always' or 'never').",
217+
Default:string(codersdk.AutomaticUpdatesNever),
218+
Value:clibase.StringOf(&autoUpdates),
219+
},
211220
cliui.SkipPromptOption(),
212221
)
213222
cmd.Options=append(cmd.Options,parameterFlags.cliParameters()...)

‎cli/create_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ func TestCreate(t *testing.T) {
3838
"--template",template.Name,
3939
"--start-at","9:30AM Mon-Fri US/Central",
4040
"--stop-after","8h",
41+
"--automatic-updates","always",
4142
}
4243
inv,root:=clitest.New(t,args...)
4344
clitest.SetupConfig(t,client,root)
@@ -73,6 +74,7 @@ func TestCreate(t *testing.T) {
7374
ifassert.NotNil(t,ws.TTLMillis) {
7475
assert.Equal(t,*ws.TTLMillis,8*time.Hour.Milliseconds())
7576
}
77+
assert.Equal(t,codersdk.AutomaticUpdatesAlways,ws.AutomaticUpdates)
7678
}
7779
})
7880

‎cli/testdata/coder_create_--help.golden

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ USAGE:
1010
$ coder create <username>/<workspace_name>
1111

1212
OPTIONS:
13+
--automatic-updates string, $CODER_WORKSPACE_AUTOMATIC_UPDATES (default: never)
14+
Specify automatic updates setting for the workspace (accepts 'always'
15+
or 'never').
16+
1317
--parameter string-array, $CODER_RICH_PARAMETER
1418
Rich parameter value in the format "name=value".
1519

‎cli/testdata/coder_list_--output_json.golden

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"health": {
5858
"healthy": true,
5959
"failing_agents": []
60-
}
60+
},
61+
"automatic_updates": "never"
6162
}
6263
]

‎coderd/apidoc/docs.go

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

‎coderd/apidoc/swagger.json

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

‎coderd/autobuild/lifecycle_executor.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ func (e *Executor) runOnce(t time.Time) Stats {
177177
SetLastWorkspaceBuildInTx(&latestBuild).
178178
SetLastWorkspaceBuildJobInTx(&latestJob).
179179
Reason(reason)
180+
log.Debug(e.ctx,"auto building workspace",slog.F("transition",nextTransition))
181+
ifnextTransition==database.WorkspaceTransitionStart&&
182+
ws.AutomaticUpdates==database.AutomaticUpdatesAlways {
183+
log.Debug(e.ctx,"autostarting with active version")
184+
builder=builder.ActiveVersion()
185+
}
180186

181187
build,job,err=builder.Build(e.ctx,tx,nil)
182188
iferr!=nil {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp