From b746c5cdec523b58c113edb1a14a40150b23f6b4 Mon Sep 17 00:00:00 2001 From: Charlie Moog Date: Mon, 14 Dec 2020 20:20:54 +0000 Subject: [PATCH 1/3] fix: remove CVM flags from edit command --- coder-sdk/env.go | 1 - internal/cmd/envs.go | 18 ------------------ 2 files changed, 19 deletions(-) diff --git a/coder-sdk/env.go b/coder-sdk/env.go index e8962971..7828f751 100644 --- a/coder-sdk/env.go +++ b/coder-sdk/env.go @@ -132,7 +132,6 @@ type UpdateEnvironmentReq struct { GPUs *int `json:"gpus"` Services *[]string `json:"services"` CodeServerReleaseURL *string `json:"code_server_release_url"` - UseContainerVM *bool `json:"use_container_vm"` } // RebuildEnvironment requests that the given envID is rebuilt with no changes to its specification. diff --git a/internal/cmd/envs.go b/internal/cmd/envs.go index 4cc62e50..621639bc 100644 --- a/internal/cmd/envs.go +++ b/internal/cmd/envs.go @@ -260,8 +260,6 @@ func editEnvCmd() *cobra.Command { disk int gpus int follow bool - useCVM bool - notCVM bool user string ) @@ -307,8 +305,6 @@ coder envs edit back-end-env --disk 20`, image: img, imageTag: tag, orgName: org, - useCVM: useCVM, - notCVM: notCVM, }) if err != nil { return err @@ -341,8 +337,6 @@ coder envs edit back-end-env --disk 20`, cmd.Flags().IntVarP(&disk, "disk", "d", 0, "The amount of disk storage an environment should be provisioned with.") cmd.Flags().IntVarP(&gpus, "gpu", "g", 0, "The amount of disk storage to provision the environment with.") cmd.Flags().BoolVar(&follow, "follow", false, "follow buildlog after initiating rebuild") - cmd.Flags().BoolVar(&useCVM, "container-vm", false, "deploy the environment as a Container-based VM") - cmd.Flags().BoolVar(¬CVM, "not-container-vm", false, "do not deploy the environment as a Container-based VM") cmd.Flags().StringVar(&user, "user", coder.Me, "Specify the user whose resources to target") return cmd } @@ -412,8 +406,6 @@ type updateConf struct { image string imageTag string orgName string - useCVM bool - notCVM bool } func boolP(a bool) *bool { return &a } @@ -426,16 +418,6 @@ func buildUpdateReq(ctx context.Context, client *coder.Client, conf updateConf) defaultDiskGB int ) - if conf.useCVM && conf.notCVM { - return nil, xerrors.New("--container-vm and --not-container-vm flags conflict") - } - if conf.useCVM { - updateReq.UseContainerVM = boolP(true) - } - if conf.notCVM { - updateReq.UseContainerVM = boolP(false) - } - // If this is not empty it means the user is requesting to change the environment image. if conf.image != "" { importedImg, err := findImg(ctx, client, findImgConf{ From 17386f901a9d33f2175a0c6adbfd99476395e5a5 Mon Sep 17 00:00:00 2001 From: Charlie Moog Date: Mon, 14 Dec 2020 20:29:48 +0000 Subject: [PATCH 2/3] fixup! fix: remove CVM flags from edit command --- docs/coder_envs_create.md | 20 ++++++++++---------- docs/coder_envs_edit.md | 22 ++++++++++------------ internal/cmd/envs.go | 2 +- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/docs/coder_envs_create.md b/docs/coder_envs_create.md index c708fa3e..d728e34b 100644 --- a/docs/coder_envs_create.md +++ b/docs/coder_envs_create.md @@ -21,16 +21,16 @@ coder envs create my-new-powerful-env --cpu 12 --disk 100 --memory 16 --image ub ### Options ``` - --container-vm deploy the environment as a Container-based VM - -c, --cpu float32 number of cpu cores the environment should be provisioned with. - -d, --disk int GB of disk storage an environment should be provisioned with. - --follow follow buildlog after initiating rebuild - -g, --gpus int number GPUs an environment should be provisioned with. - -h, --help help for create - -i, --image string name of the image to base the environment off of. - -m, --memory float32 GB of RAM an environment should be provisioned with. - -o, --org string name of the organization the environment should be created under. - -t, --tag string tag of the image the environment will be based off of. (default "latest") + --container-based-vm deploy the environment as a Container-based VM + -c, --cpu float32 number of cpu cores the environment should be provisioned with. + -d, --disk int GB of disk storage an environment should be provisioned with. + --follow follow buildlog after initiating rebuild + -g, --gpus int number GPUs an environment should be provisioned with. + -h, --help help for create + -i, --image string name of the image to base the environment off of. + -m, --memory float32 GB of RAM an environment should be provisioned with. + -o, --org string name of the organization the environment should be created under. + -t, --tag string tag of the image the environment will be based off of. (default "latest") ``` ### Options inherited from parent commands diff --git a/docs/coder_envs_edit.md b/docs/coder_envs_edit.md index abec71f2..faf298d8 100644 --- a/docs/coder_envs_edit.md +++ b/docs/coder_envs_edit.md @@ -21,18 +21,16 @@ coder envs edit back-end-env --disk 20 ### Options ``` - --container-vm deploy the environment as a Container-based VM - -c, --cpu float32 The number of cpu cores the environment should be provisioned with. - -d, --disk int The amount of disk storage an environment should be provisioned with. - --follow follow buildlog after initiating rebuild - -g, --gpu int The amount of disk storage to provision the environment with. - -h, --help help for edit - -i, --image string name of the image you want the environment to be based off of. - -m, --memory float32 The amount of RAM an environment should be provisioned with. - --not-container-vm do not deploy the environment as a Container-based VM - -o, --org string name of the organization the environment should be created under. - -t, --tag string image tag of the image you want to base the environment off of. (default "latest") - --user string Specify the user whose resources to target (default "me") + -c, --cpu float32 The number of cpu cores the environment should be provisioned with. + -d, --disk int The amount of disk storage an environment should be provisioned with. + --follow follow buildlog after initiating rebuild + -g, --gpu int The amount of disk storage to provision the environment with. + -h, --help help for edit + -i, --image string name of the image you want the environment to be based off of. + -m, --memory float32 The amount of RAM an environment should be provisioned with. + -o, --org string name of the organization the environment should be created under. + -t, --tag string image tag of the image you want to base the environment off of. (default "latest") + --user string Specify the user whose resources to target (default "me") ``` ### Options inherited from parent commands diff --git a/internal/cmd/envs.go b/internal/cmd/envs.go index 621639bc..604cba47 100644 --- a/internal/cmd/envs.go +++ b/internal/cmd/envs.go @@ -245,7 +245,7 @@ coder envs create my-new-powerful-env --cpu 12 --disk 100 --memory 16 --image ub cmd.Flags().IntVarP(&gpus, "gpus", "g", 0, "number GPUs an environment should be provisioned with.") cmd.Flags().StringVarP(&img, "image", "i", "", "name of the image to base the environment off of.") cmd.Flags().BoolVar(&follow, "follow", false, "follow buildlog after initiating rebuild") - cmd.Flags().BoolVar(&useCVM, "container-vm", false, "deploy the environment as a Container-based VM") + cmd.Flags().BoolVar(&useCVM, "container-based-vm", false, "deploy the environment as a Container-based VM") _ = cmd.MarkFlagRequired("image") return cmd } From 2f0c8756de4f926050961a3415a93519b02186bb Mon Sep 17 00:00:00 2001 From: Charlie Moog Date: Mon, 14 Dec 2020 20:30:34 +0000 Subject: [PATCH 3/3] fixup! fix: remove CVM flags from edit command --- internal/cmd/envs.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/internal/cmd/envs.go b/internal/cmd/envs.go index 604cba47..f9b7fd41 100644 --- a/internal/cmd/envs.go +++ b/internal/cmd/envs.go @@ -408,8 +408,6 @@ type updateConf struct { orgName string } -func boolP(a bool) *bool { return &a } - func buildUpdateReq(ctx context.Context, client *coder.Client, conf updateConf) (*coder.UpdateEnvironmentReq, error) { var ( updateReq coder.UpdateEnvironmentReq