mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat(cli): support non-active template version pushes (#7488)
So that we can push template updates for testing without impacting normal users of the template. --------- Co-authored-by: Ammar Bandukwala <ammar@ammar.io> Co-authored-by: Muhammad Atif Ali <matifali@live.com> Co-authored-by: Atif Ali <atif@coder.com>
This commit is contained in:
co-authored by
Ammar Bandukwala
Muhammad Atif Ali
Atif Ali
parent
1f8e817da7
commit
e2613c91a7
+14
-5
@@ -115,6 +115,7 @@ func (r *RootCmd) templatePush() *clibase.Cmd {
|
||||
alwaysPrompt bool
|
||||
provisionerTags []string
|
||||
uploadFlags templateUploadFlags
|
||||
activate bool
|
||||
)
|
||||
client := new(codersdk.Client)
|
||||
cmd := &clibase.Cmd{
|
||||
@@ -172,11 +173,13 @@ func (r *RootCmd) templatePush() *clibase.Cmd {
|
||||
return xerrors.Errorf("job failed: %s", job.Job.Status)
|
||||
}
|
||||
|
||||
err = client.UpdateActiveTemplateVersion(inv.Context(), template.ID, codersdk.UpdateActiveTemplateVersion{
|
||||
ID: job.ID,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
if activate {
|
||||
err = client.UpdateActiveTemplateVersion(inv.Context(), template.ID, codersdk.UpdateActiveTemplateVersion{
|
||||
ID: job.ID,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
_, _ = fmt.Fprintf(inv.Stdout, "Updated version at %s!\n", cliui.Styles.DateTimeStamp.Render(time.Now().Format(time.Stamp)))
|
||||
@@ -226,6 +229,12 @@ func (r *RootCmd) templatePush() *clibase.Cmd {
|
||||
Description: "Always prompt all parameters. Does not pull parameter values from active template version.",
|
||||
Value: clibase.BoolOf(&alwaysPrompt),
|
||||
},
|
||||
{
|
||||
Flag: "activate",
|
||||
Description: "Whether the new template will be marked active.",
|
||||
Default: "true",
|
||||
Value: clibase.BoolOf(&activate),
|
||||
},
|
||||
cliui.SkipPromptOption(),
|
||||
uploadFlags.option(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user