From a6e3347bae89ea7cf9920908bbbf7330ea93a076 Mon Sep 17 00:00:00 2001 From: David Koenitzer Date: Wed, 6 Sep 2023 09:55:15 -0400 Subject: [PATCH 1/3] test again --- Makefile | 2 +- cmd/cloud/deployment.go | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 5566790c4..1825123fb 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ lint: ${ENVTEST_ASSETS_DIR}/golangci-lint run --timeout 3m0s build: - go build -o ${OUTPUT} -ldflags "${LDFLAGS_VERSION}" main.go + GOOS=linux GOARCH=amd64 go build -o ${OUTPUT} -ldflags "${LDFLAGS_VERSION}" main.go core_api_gen: ifeq (, $(shell which oapi-codegen)) diff --git a/cmd/cloud/deployment.go b/cmd/cloud/deployment.go index dc528c4f3..d7262d8c1 100644 --- a/cmd/cloud/deployment.go +++ b/cmd/cloud/deployment.go @@ -153,7 +153,10 @@ func newDeploymentCreateCmd(out io.Writer) *cobra.Command { cmd.Flags().BoolVarP(&waitForStatus, "wait", "i", false, "Wait for the Deployment to become healthy before ending the command") cmd.Flags().BoolVarP(&cleanOutput, "clean-output", "", false, "clean output to only include inspect yaml or json file in any situation.") cmd.Flags().BoolVarP(&deploymentCreateEnforceCD, "enforce-cicd", "", false, "Provide this flag means deploys to deployment must use an API Key or Token. This essentially forces Deploys to happen through CI/CD") + fmt.Println("is org hosted:") + fmt.Println(organization.IsOrgHosted()) if organization.IsOrgHosted() { + fmt.Println("hosted org flags") cmd.Flags().StringVarP(&clusterType, "cluster-type", "", standard, "The Cluster Type to use for the Deployment. Possible values can be standard or dedicated.") cmd.Flags().StringVarP(&cloudProvider, "cloud-provider", "p", "gcp", "The Cloud Provider to use for the Deployment. Possible values can be gcp, aws.") cmd.Flags().StringVarP(®ion, "region", "", "", "The Cloud Provider region to use for the Deployment.") @@ -347,9 +350,10 @@ func deploymentCreate(cmd *cobra.Command, _ []string, out io.Writer) error { //n if highAvailability != "" && !(highAvailability == enable || highAvailability == disable) { return errors.New("Invalid --high-availability value") } - + fmt.Println("cluster type: " + clusterType) + fmt.Println(organization.IsOrgHosted()) if organization.IsOrgHosted() && !(clusterType == standard || clusterType == dedicated) { - return errors.New("Invalid --cluster-type value") + return errors.New("Invalid --cluster-type value: " + clusterType) } // request is to create from a file From 1f4625ce7c49a2599c91d78436ef8e79446e73ce Mon Sep 17 00:00:00 2001 From: David Koenitzer Date: Wed, 6 Sep 2023 12:38:01 -0400 Subject: [PATCH 2/3] fix issue --- Makefile | 2 +- cmd/cloud/deployment.go | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 1825123fb..5566790c4 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ lint: ${ENVTEST_ASSETS_DIR}/golangci-lint run --timeout 3m0s build: - GOOS=linux GOARCH=amd64 go build -o ${OUTPUT} -ldflags "${LDFLAGS_VERSION}" main.go + go build -o ${OUTPUT} -ldflags "${LDFLAGS_VERSION}" main.go core_api_gen: ifeq (, $(shell which oapi-codegen)) diff --git a/cmd/cloud/deployment.go b/cmd/cloud/deployment.go index d7262d8c1..deaf87b54 100644 --- a/cmd/cloud/deployment.go +++ b/cmd/cloud/deployment.go @@ -49,12 +49,12 @@ var ( executor string inputFile string cloudProvider string - clusterType string region string schedulerSize string highAvailability string deploymentCreateEnforceCD bool deploymentUpdateEnforceCD bool + clusterType = standard deploymentVariableListExample = ` # List a deployment's variables $ astro deployment variable list --deployment-id --key FOO @@ -153,10 +153,7 @@ func newDeploymentCreateCmd(out io.Writer) *cobra.Command { cmd.Flags().BoolVarP(&waitForStatus, "wait", "i", false, "Wait for the Deployment to become healthy before ending the command") cmd.Flags().BoolVarP(&cleanOutput, "clean-output", "", false, "clean output to only include inspect yaml or json file in any situation.") cmd.Flags().BoolVarP(&deploymentCreateEnforceCD, "enforce-cicd", "", false, "Provide this flag means deploys to deployment must use an API Key or Token. This essentially forces Deploys to happen through CI/CD") - fmt.Println("is org hosted:") - fmt.Println(organization.IsOrgHosted()) if organization.IsOrgHosted() { - fmt.Println("hosted org flags") cmd.Flags().StringVarP(&clusterType, "cluster-type", "", standard, "The Cluster Type to use for the Deployment. Possible values can be standard or dedicated.") cmd.Flags().StringVarP(&cloudProvider, "cloud-provider", "p", "gcp", "The Cloud Provider to use for the Deployment. Possible values can be gcp, aws.") cmd.Flags().StringVarP(®ion, "region", "", "", "The Cloud Provider region to use for the Deployment.") @@ -350,10 +347,8 @@ func deploymentCreate(cmd *cobra.Command, _ []string, out io.Writer) error { //n if highAvailability != "" && !(highAvailability == enable || highAvailability == disable) { return errors.New("Invalid --high-availability value") } - fmt.Println("cluster type: " + clusterType) - fmt.Println(organization.IsOrgHosted()) if organization.IsOrgHosted() && !(clusterType == standard || clusterType == dedicated) { - return errors.New("Invalid --cluster-type value: " + clusterType) + return errors.New("Invalid --cluster-type value") } // request is to create from a file From 23120130372083396356d3fc7e39e2baa1f0bff3 Mon Sep 17 00:00:00 2001 From: David Koenitzer Date: Wed, 6 Sep 2023 12:39:59 -0400 Subject: [PATCH 3/3] fix spacing --- cmd/cloud/deployment.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/cloud/deployment.go b/cmd/cloud/deployment.go index deaf87b54..9985bc458 100644 --- a/cmd/cloud/deployment.go +++ b/cmd/cloud/deployment.go @@ -347,6 +347,7 @@ func deploymentCreate(cmd *cobra.Command, _ []string, out io.Writer) error { //n if highAvailability != "" && !(highAvailability == enable || highAvailability == disable) { return errors.New("Invalid --high-availability value") } + if organization.IsOrgHosted() && !(clusterType == standard || clusterType == dedicated) { return errors.New("Invalid --cluster-type value") }