|
8 | 8 | "golang.org/x/xerrors"
|
9 | 9 |
|
10 | 10 | "github.com/coder/coder/v2/cli/cliui"
|
| 11 | +"github.com/coder/coder/v2/cli/cliutil" |
11 | 12 | "github.com/coder/coder/v2/codersdk"
|
12 | 13 | "github.com/coder/serpent"
|
13 | 14 | )
|
@@ -35,6 +36,23 @@ func (r *RootCmd) start() *serpent.Command {
|
35 | 36 | }
|
36 | 37 | varbuild codersdk.WorkspaceBuild
|
37 | 38 | switchworkspace.LatestBuild.Status {
|
| 39 | +casecodersdk.WorkspaceStatusPending: |
| 40 | +// The above check is technically duplicated in cliutil.WarnmatchedProvisioners |
| 41 | +// but we still want to avoid users spamming multiple builds that will |
| 42 | +// not be picked up. |
| 43 | +_,_=fmt.Fprintf( |
| 44 | +inv.Stdout, |
| 45 | +"\nThe %s workspace is waiting to start!\n", |
| 46 | +cliui.Keyword(workspace.Name), |
| 47 | +) |
| 48 | +cliutil.WarnMatchedProvisioners(inv.Stderr,workspace.LatestBuild.MatchedProvisioners,workspace.LatestBuild.Job) |
| 49 | +if_,err:=cliui.Prompt(inv, cliui.PromptOptions{ |
| 50 | +Text:"Enqueue another start?", |
| 51 | +IsConfirm:true, |
| 52 | +Default:cliui.ConfirmNo, |
| 53 | +});err!=nil { |
| 54 | +returnerr |
| 55 | +} |
38 | 56 | casecodersdk.WorkspaceStatusRunning:
|
39 | 57 | _,_=fmt.Fprintf(
|
40 | 58 | inv.Stdout,"\nThe %s workspace is already running!\n",
|
@@ -159,6 +177,7 @@ func startWorkspace(inv *serpent.Invocation, client *codersdk.Client, workspace
|
159 | 177 | iferr!=nil {
|
160 | 178 | return codersdk.WorkspaceBuild{},xerrors.Errorf("create workspace build: %w",err)
|
161 | 179 | }
|
| 180 | +cliutil.WarnMatchedProvisioners(inv.Stderr,build.MatchedProvisioners,build.Job) |
162 | 181 |
|
163 | 182 | returnbuild,nil
|
164 | 183 | }
|