feat(cli): add --provisioner-log-debug option (#14558)

Allows starting a build in debug mode from the CLI without needing
to have the build fail first by adding `--provisioner-log-debug`.
This commit is contained in:
Cian Johnston
2024-09-04 14:39:35 +01:00
committed by GitHub
parent bd90740166
commit bcf9bc3c90
8 changed files with 77 additions and 24 deletions

View File

@ -10,6 +10,7 @@ import (
)
func (r *RootCmd) stop() *serpent.Command {
var bflags buildFlags
client := new(codersdk.Client)
cmd := &serpent.Command{
Annotations: workspaceCommand,
@ -35,9 +36,13 @@ func (r *RootCmd) stop() *serpent.Command {
if err != nil {
return err
}
build, err := client.CreateWorkspaceBuild(inv.Context(), workspace.ID, codersdk.CreateWorkspaceBuildRequest{
wbr := codersdk.CreateWorkspaceBuildRequest{
Transition: codersdk.WorkspaceTransitionStop,
})
}
if bflags.provisionerLogDebug {
wbr.LogLevel = codersdk.ProvisionerLogLevelDebug
}
build, err := client.CreateWorkspaceBuild(inv.Context(), workspace.ID, wbr)
if err != nil {
return err
}
@ -56,5 +61,7 @@ func (r *RootCmd) stop() *serpent.Command {
return nil
},
}
cmd.Options = append(cmd.Options, bflags.cliOptions()...)
return cmd
}