From 0ee0554692a5e0f0926a0f43d98b23f9c1451ca4 Mon Sep 17 00:00:00 2001 From: David Gamero Date: Mon, 17 Apr 2023 16:01:20 -0400 Subject: [PATCH 01/13] change default deploytype to avoid defaulting to invalid type --- cmd/create.go | 17 ++++++++++++----- pkg/deployments/deployments.go | 9 +++++---- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/cmd/create.go b/cmd/create.go index 57dcbd54..ef21d0a7 100644 --- a/cmd/create.go +++ b/cmd/create.go @@ -7,11 +7,12 @@ import ( "os" "strings" + "golang.org/x/exp/maps" + "gopkg.in/yaml.v3" + "github.com/manifoldco/promptui" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" - "golang.org/x/exp/maps" - "gopkg.in/yaml.v3" "github.com/Azure/draft/pkg/config" "github.com/Azure/draft/pkg/deployments" @@ -74,7 +75,7 @@ func newCreateCmd() *cobra.Command { f.StringVarP(&cc.appName, "app", "a", "", "specify the name of the helm release") f.StringVarP(&cc.lang, "language", "l", "", "specify the language used to create the Kubernetes deployment") f.StringVarP(&cc.dest, "destination", "d", ".", "specify the path to the project directory") - f.StringVarP(&cc.deployType, "deploy-type", "", ".", "specify deployement type (eg. helm, kustomize, manifests)") + f.StringVarP(&cc.deployType, "deploy-type", "", "", "specify deployement type (eg. helm, kustomize, manifests)") f.BoolVar(&cc.dockerfileOnly, "dockerfile-only", false, "only create Dockerfile in the project directory") f.BoolVar(&cc.deploymentOnly, "deployment-only", false, "only create deployment files in the project directory") f.BoolVar(&cc.skipFileDetection, "skip-file-detection", false, "skip file detection step") @@ -287,7 +288,10 @@ func (cc *createCmd) createDeployment() error { if cc.createConfig.DeployType != "" { deployType = strings.ToLower(cc.createConfig.DeployType) - deployConfig := d.GetConfig(deployType) + deployConfig, err := d.GetConfig(deployType) + if err != nil { + return err + } if deployConfig == nil { return errors.New("invalid deployment type") } @@ -311,7 +315,10 @@ func (cc *createCmd) createDeployment() error { deployType = cc.deployType } - deployConfig := d.GetConfig(deployType) + deployConfig, err := d.GetConfig(deployType) + if err != nil { + return err + } customInputs, err = prompts.RunPromptsFromConfigWithSkips(deployConfig, maps.Keys(flagVariablesMap)) if err != nil { return err diff --git a/pkg/deployments/deployments.go b/pkg/deployments/deployments.go index 32b3a089..7d13ce71 100644 --- a/pkg/deployments/deployments.go +++ b/pkg/deployments/deployments.go @@ -6,10 +6,11 @@ import ( "io/fs" "path" - log "github.com/sirupsen/logrus" "golang.org/x/exp/maps" "gopkg.in/yaml.v3" + log "github.com/sirupsen/logrus" + "github.com/Azure/draft/pkg/config" "github.com/Azure/draft/pkg/embedutils" "github.com/Azure/draft/pkg/osutil" @@ -74,12 +75,12 @@ func (d *Deployments) loadConfig(lang string) (*config.DraftConfig, error) { return &draftConfig, nil } -func (d *Deployments) GetConfig(deployType string) *config.DraftConfig { +func (d *Deployments) GetConfig(deployType string) (*config.DraftConfig, error) { val, ok := d.configs[deployType] if !ok { - return nil + return nil, fmt.Errorf("deployment type: %s is not currently supported", deployType) } - return val + return val, nil } func (d *Deployments) PopulateConfigs() { From 8622c4212938940859b3dff70b94aa04171683fe Mon Sep 17 00:00:00 2001 From: David Gamero Date: Tue, 18 Apr 2023 14:33:25 -0400 Subject: [PATCH 02/13] add default deploy type test --- cmd/create.go | 7 ++++++- cmd/create_test.go | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/create.go b/cmd/create.go index ef21d0a7..856f9332 100644 --- a/cmd/create.go +++ b/cmd/create.go @@ -34,6 +34,11 @@ var flagVariablesMap = make(map[string]string) const LANGUAGE_VARIABLE = "LANGUAGE" const TWO_SPACES = " " +// Flag defaults +const ( + defaultDeployType = "" +) + type createCmd struct { appName string lang string @@ -75,7 +80,7 @@ func newCreateCmd() *cobra.Command { f.StringVarP(&cc.appName, "app", "a", "", "specify the name of the helm release") f.StringVarP(&cc.lang, "language", "l", "", "specify the language used to create the Kubernetes deployment") f.StringVarP(&cc.dest, "destination", "d", ".", "specify the path to the project directory") - f.StringVarP(&cc.deployType, "deploy-type", "", "", "specify deployement type (eg. helm, kustomize, manifests)") + f.StringVarP(&cc.deployType, "deploy-type", "", defaultDeployType, "specify deployement type (eg. helm, kustomize, manifests)") f.BoolVar(&cc.dockerfileOnly, "dockerfile-only", false, "only create Dockerfile in the project directory") f.BoolVar(&cc.deploymentOnly, "deployment-only", false, "only create deployment files in the project directory") f.BoolVar(&cc.skipFileDetection, "skip-file-detection", false, "skip file detection step") diff --git a/cmd/create_test.go b/cmd/create_test.go index 74a14f86..832ad9de 100644 --- a/cmd/create_test.go +++ b/cmd/create_test.go @@ -206,6 +206,11 @@ func (mcc *createCmd) mockDetectLanguage() (*config.DraftConfig, string, error) } return nil, "", ErrNoLanguageDetected } +func TestDefaultValues(t *testing.T) { + if defaultDeployType != "" { + t.Fail() + } +} func getAllDeploymentFiles(src string) (error, []string) { deploymentFiles := []string{} From ef028fc414db0f7ab8e94fb915f20f87b2b97a19 Mon Sep 17 00:00:00 2001 From: David Gamero Date: Thu, 20 Apr 2023 18:23:06 -0400 Subject: [PATCH 03/13] update to blank defaultDeployType --- .github/workflows/integration-linux.yml | 12 ++++++------ .github/workflows/integration-windows.yml | 4 ++-- cmd/create.go | 4 ++-- cmd/create_test.go | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/integration-linux.yml b/.github/workflows/integration-linux.yml index a66b797e..26cd789c 100644 --- a/.github/workflows/integration-linux.yml +++ b/.github/workflows/integration-linux.yml @@ -3542,7 +3542,7 @@ jobs: - run: mkdir ./langtest - uses: actions/checkout@v3 with: - repository: imiller31/simple-gradle-server + repository: davidgamero/simple-gradle-server path: ./langtest - name: Execute Dry Run with config file run: | @@ -3577,7 +3577,7 @@ jobs: - run: mkdir ./langtest - uses: actions/checkout@v3 with: - repository: imiller31/simple-gradle-server + repository: davidgamero/simple-gradle-server path: ./langtest - run: rm -rf ./langtest/manifests && rm -f ./langtest/Dockerfile ./langtest/.dockerignore - run: ./draft -v create -c ./test/integration/gradle/helm.yaml -d ./langtest/ @@ -3683,7 +3683,7 @@ jobs: - run: mkdir ./langtest - uses: actions/checkout@v3 with: - repository: imiller31/simple-gradle-server + repository: davidgamero/simple-gradle-server path: ./langtest - name: Execute Dry Run with config file run: | @@ -3718,7 +3718,7 @@ jobs: - run: mkdir ./langtest - uses: actions/checkout@v3 with: - repository: imiller31/simple-gradle-server + repository: davidgamero/simple-gradle-server path: ./langtest - run: rm -rf ./langtest/manifests && rm -f ./langtest/Dockerfile ./langtest/.dockerignore - run: ./draft -v create -c ./test/integration/gradle/kustomize.yaml -d ./langtest/ @@ -3815,7 +3815,7 @@ jobs: - run: mkdir ./langtest - uses: actions/checkout@v3 with: - repository: imiller31/simple-gradle-server + repository: davidgamero/simple-gradle-server path: ./langtest - name: Execute Dry Run with config file run: | @@ -3850,7 +3850,7 @@ jobs: - run: mkdir ./langtest - uses: actions/checkout@v3 with: - repository: imiller31/simple-gradle-server + repository: davidgamero/simple-gradle-server path: ./langtest - run: rm -rf ./langtest/manifests && rm -f ./langtest/Dockerfile ./langtest/.dockerignore - run: ./draft -v create -c ./test/integration/gradle/manifest.yaml -d ./langtest/ diff --git a/.github/workflows/integration-windows.yml b/.github/workflows/integration-windows.yml index 397e9a0b..9ab33f82 100644 --- a/.github/workflows/integration-windows.yml +++ b/.github/workflows/integration-windows.yml @@ -819,7 +819,7 @@ jobs: - run: mkdir ./langtest - uses: actions/checkout@v3 with: - repository: imiller31/simple-gradle-server + repository: davidgamero/simple-gradle-server path: ./langtest - run: Remove-Item ./langtest/manifests -Recurse -Force -ErrorAction Ignore - run: Remove-Item ./langtest/Dockerfile -ErrorAction Ignore @@ -867,7 +867,7 @@ jobs: - run: mkdir ./langtest - uses: actions/checkout@v3 with: - repository: imiller31/simple-gradle-server + repository: davidgamero/simple-gradle-server path: ./langtest - run: Remove-Item ./langtest/manifests -Recurse -Force -ErrorAction Ignore - run: Remove-Item ./langtest/Dockerfile -ErrorAction Ignore diff --git a/cmd/create.go b/cmd/create.go index 856f9332..1cb4a8a9 100644 --- a/cmd/create.go +++ b/cmd/create.go @@ -36,7 +36,7 @@ const TWO_SPACES = " " // Flag defaults const ( - defaultDeployType = "" + blankDefaultDeployType = "" ) type createCmd struct { @@ -80,7 +80,7 @@ func newCreateCmd() *cobra.Command { f.StringVarP(&cc.appName, "app", "a", "", "specify the name of the helm release") f.StringVarP(&cc.lang, "language", "l", "", "specify the language used to create the Kubernetes deployment") f.StringVarP(&cc.dest, "destination", "d", ".", "specify the path to the project directory") - f.StringVarP(&cc.deployType, "deploy-type", "", defaultDeployType, "specify deployement type (eg. helm, kustomize, manifests)") + f.StringVarP(&cc.deployType, "deploy-type", "", blankDefaultDeployType, "specify deployement type (eg. helm, kustomize, manifests)") f.BoolVar(&cc.dockerfileOnly, "dockerfile-only", false, "only create Dockerfile in the project directory") f.BoolVar(&cc.deploymentOnly, "deployment-only", false, "only create deployment files in the project directory") f.BoolVar(&cc.skipFileDetection, "skip-file-detection", false, "skip file detection step") diff --git a/cmd/create_test.go b/cmd/create_test.go index 832ad9de..b74834db 100644 --- a/cmd/create_test.go +++ b/cmd/create_test.go @@ -207,7 +207,7 @@ func (mcc *createCmd) mockDetectLanguage() (*config.DraftConfig, string, error) return nil, "", ErrNoLanguageDetected } func TestDefaultValues(t *testing.T) { - if defaultDeployType != "" { + if blankDefaultDeployType != "" { t.Fail() } } From e946ad68c1dd7bb67f0cb3722aa8a78e78064a7e Mon Sep 17 00:00:00 2001 From: David Gamero Date: Fri, 21 Apr 2023 11:31:01 -0400 Subject: [PATCH 04/13] regen workflows --- .github/workflows/integration-linux.yml | 12 ++++++------ .github/workflows/integration-windows.yml | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/integration-linux.yml b/.github/workflows/integration-linux.yml index 26cd789c..a66b797e 100644 --- a/.github/workflows/integration-linux.yml +++ b/.github/workflows/integration-linux.yml @@ -3542,7 +3542,7 @@ jobs: - run: mkdir ./langtest - uses: actions/checkout@v3 with: - repository: davidgamero/simple-gradle-server + repository: imiller31/simple-gradle-server path: ./langtest - name: Execute Dry Run with config file run: | @@ -3577,7 +3577,7 @@ jobs: - run: mkdir ./langtest - uses: actions/checkout@v3 with: - repository: davidgamero/simple-gradle-server + repository: imiller31/simple-gradle-server path: ./langtest - run: rm -rf ./langtest/manifests && rm -f ./langtest/Dockerfile ./langtest/.dockerignore - run: ./draft -v create -c ./test/integration/gradle/helm.yaml -d ./langtest/ @@ -3683,7 +3683,7 @@ jobs: - run: mkdir ./langtest - uses: actions/checkout@v3 with: - repository: davidgamero/simple-gradle-server + repository: imiller31/simple-gradle-server path: ./langtest - name: Execute Dry Run with config file run: | @@ -3718,7 +3718,7 @@ jobs: - run: mkdir ./langtest - uses: actions/checkout@v3 with: - repository: davidgamero/simple-gradle-server + repository: imiller31/simple-gradle-server path: ./langtest - run: rm -rf ./langtest/manifests && rm -f ./langtest/Dockerfile ./langtest/.dockerignore - run: ./draft -v create -c ./test/integration/gradle/kustomize.yaml -d ./langtest/ @@ -3815,7 +3815,7 @@ jobs: - run: mkdir ./langtest - uses: actions/checkout@v3 with: - repository: davidgamero/simple-gradle-server + repository: imiller31/simple-gradle-server path: ./langtest - name: Execute Dry Run with config file run: | @@ -3850,7 +3850,7 @@ jobs: - run: mkdir ./langtest - uses: actions/checkout@v3 with: - repository: davidgamero/simple-gradle-server + repository: imiller31/simple-gradle-server path: ./langtest - run: rm -rf ./langtest/manifests && rm -f ./langtest/Dockerfile ./langtest/.dockerignore - run: ./draft -v create -c ./test/integration/gradle/manifest.yaml -d ./langtest/ diff --git a/.github/workflows/integration-windows.yml b/.github/workflows/integration-windows.yml index 9ab33f82..397e9a0b 100644 --- a/.github/workflows/integration-windows.yml +++ b/.github/workflows/integration-windows.yml @@ -819,7 +819,7 @@ jobs: - run: mkdir ./langtest - uses: actions/checkout@v3 with: - repository: davidgamero/simple-gradle-server + repository: imiller31/simple-gradle-server path: ./langtest - run: Remove-Item ./langtest/manifests -Recurse -Force -ErrorAction Ignore - run: Remove-Item ./langtest/Dockerfile -ErrorAction Ignore @@ -867,7 +867,7 @@ jobs: - run: mkdir ./langtest - uses: actions/checkout@v3 with: - repository: davidgamero/simple-gradle-server + repository: imiller31/simple-gradle-server path: ./langtest - run: Remove-Item ./langtest/manifests -Recurse -Force -ErrorAction Ignore - run: Remove-Item ./langtest/Dockerfile -ErrorAction Ignore From 762142df62a7bc62ac46a129e6173005ff80f2ce Mon Sep 17 00:00:00 2001 From: David Gamero Date: Fri, 21 Apr 2023 14:35:08 -0400 Subject: [PATCH 05/13] add more blank default protections --- cmd/create.go | 15 +++++++-------- cmd/create_test.go | 6 +++--- cmd/generate-workflow.go | 16 ++++++++-------- cmd/setup-gh.go | 8 ++++---- 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/cmd/create.go b/cmd/create.go index 1cb4a8a9..3e8db48b 100644 --- a/cmd/create.go +++ b/cmd/create.go @@ -35,9 +35,8 @@ const LANGUAGE_VARIABLE = "LANGUAGE" const TWO_SPACES = " " // Flag defaults -const ( - blankDefaultDeployType = "" -) +const emptyDefaultFlagValue = "" +const currentDirDefaultFlagValue = "." type createCmd struct { appName string @@ -76,11 +75,11 @@ func newCreateCmd() *cobra.Command { f := cmd.Flags() - f.StringVarP(&cc.createConfigPath, "create-config", "c", "", "specify the path to the configuration file") - f.StringVarP(&cc.appName, "app", "a", "", "specify the name of the helm release") - f.StringVarP(&cc.lang, "language", "l", "", "specify the language used to create the Kubernetes deployment") - f.StringVarP(&cc.dest, "destination", "d", ".", "specify the path to the project directory") - f.StringVarP(&cc.deployType, "deploy-type", "", blankDefaultDeployType, "specify deployement type (eg. helm, kustomize, manifests)") + f.StringVarP(&cc.createConfigPath, "create-config", "c", emptyDefaultFlagValue, "specify the path to the configuration file") + f.StringVarP(&cc.appName, "app", "a", emptyDefaultFlagValue, "specify the name of the helm release") + f.StringVarP(&cc.lang, "language", "l", emptyDefaultFlagValue, "specify the language used to create the Kubernetes deployment") + f.StringVarP(&cc.dest, "destination", "d", currentDirDefaultFlagValue, "specify the path to the project directory") + f.StringVarP(&cc.deployType, "deploy-type", "", emptyDefaultFlagValue, "specify deployement type (eg. helm, kustomize, manifests)") f.BoolVar(&cc.dockerfileOnly, "dockerfile-only", false, "only create Dockerfile in the project directory") f.BoolVar(&cc.deploymentOnly, "deployment-only", false, "only create deployment files in the project directory") f.BoolVar(&cc.skipFileDetection, "skip-file-detection", false, "skip file detection step") diff --git a/cmd/create_test.go b/cmd/create_test.go index b74834db..58380f2b 100644 --- a/cmd/create_test.go +++ b/cmd/create_test.go @@ -206,10 +206,10 @@ func (mcc *createCmd) mockDetectLanguage() (*config.DraftConfig, string, error) } return nil, "", ErrNoLanguageDetected } + func TestDefaultValues(t *testing.T) { - if blankDefaultDeployType != "" { - t.Fail() - } + assert.Equal(t, emptyDefaultFlagValue, "") + assert.Equal(t, currentDirDefaultFlagValue, ".") } func getAllDeploymentFiles(src string) (error, []string) { diff --git a/cmd/generate-workflow.go b/cmd/generate-workflow.go index 6e1522d9..908f5ac2 100644 --- a/cmd/generate-workflow.go +++ b/cmd/generate-workflow.go @@ -44,15 +44,15 @@ with draft on AKS. This command assumes the 'setup-gh' command has been run prop } f := cmd.Flags() - f.StringVarP(&gwCmd.workflowConfig.AksClusterName, "cluster-name", "c", "", "specify the AKS cluster name") - f.StringVarP(&gwCmd.workflowConfig.AcrName, "registry-name", "r", "", "specify the Azure container registry name") - f.StringVar(&gwCmd.workflowConfig.ContainerName, "container-name", "", "specify the container image name") - f.StringVarP(&gwCmd.workflowConfig.ResourceGroupName, "resource-group", "g", "", "specify the Azure resource group of your AKS cluster") - f.StringVarP(&gwCmd.dest, "destination", "d", ".", "specify the path to the project directory") - f.StringVarP(&gwCmd.workflowConfig.BranchName, "branch", "b", "", "specify the Github branch to automatically deploy from") - f.StringVar(&gwCmd.deployType, "deploy-type", "", "specify the type of deployment") + f.StringVarP(&gwCmd.workflowConfig.AksClusterName, "cluster-name", "c", emptyDefaultFlagValue, "specify the AKS cluster name") + f.StringVarP(&gwCmd.workflowConfig.AcrName, "registry-name", "r", emptyDefaultFlagValue, "specify the Azure container registry name") + f.StringVar(&gwCmd.workflowConfig.ContainerName, "container-name", emptyDefaultFlagValue, "specify the container image name") + f.StringVarP(&gwCmd.workflowConfig.ResourceGroupName, "resource-group", "g", emptyDefaultFlagValue, "specify the Azure resource group of your AKS cluster") + f.StringVarP(&gwCmd.dest, "destination", "d", currentDirDefaultFlagValue, "specify the path to the project directory") + f.StringVarP(&gwCmd.workflowConfig.BranchName, "branch", "b", emptyDefaultFlagValue, "specify the Github branch to automatically deploy from") + f.StringVar(&gwCmd.deployType, "deploy-type", emptyDefaultFlagValue, "specify the type of deployment") f.StringArrayVarP(&gwCmd.flagVariables, "variable", "", []string{}, "pass additional variables") - f.StringVarP(&gwCmd.workflowConfig.BuildContextPath, "build-context-path", "x", "", "specify the docker build context path") + f.StringVarP(&gwCmd.workflowConfig.BuildContextPath, "build-context-path", "x", emptyDefaultFlagValue, "specify the docker build context path") gwCmd.templateWriter = &writers.LocalFSWriter{} return cmd } diff --git a/cmd/setup-gh.go b/cmd/setup-gh.go index cd99cae3..3c5efeea 100644 --- a/cmd/setup-gh.go +++ b/cmd/setup-gh.go @@ -41,10 +41,10 @@ application and service principle, and will configure that application to trust } f := cmd.Flags() - f.StringVarP(&sc.AppName, "app", "a", "", "specify the Azure Active Directory application name") - f.StringVarP(&sc.SubscriptionID, "subscription-id", "s", "", "specify the Azure subscription ID") - f.StringVarP(&sc.ResourceGroupName, "resource-group", "r", "", "specify the Azure resource group name") - f.StringVarP(&sc.Repo, "gh-repo", "g", "", "specify the github repository link") + f.StringVarP(&sc.AppName, "app", "a", emptyDefaultFlagValue, "specify the Azure Active Directory application name") + f.StringVarP(&sc.SubscriptionID, "subscription-id", "s", emptyDefaultFlagValue, "specify the Azure subscription ID") + f.StringVarP(&sc.ResourceGroupName, "resource-group", "r", emptyDefaultFlagValue, "specify the Azure resource group name") + f.StringVarP(&sc.Repo, "gh-repo", "g", emptyDefaultFlagValue, "specify the github repository link") sc.Provider = provider return cmd } From d73ddb7cafa48fdbb44e7ff8ec4e92a5c0c090ba Mon Sep 17 00:00:00 2001 From: David Gamero Date: Fri, 21 Apr 2023 15:01:07 -0400 Subject: [PATCH 06/13] add smoke test for create defaults --- .github/workflows/defaults-smoketest.yml | 20 ++++++++++++++++++++ template/deployments/helm/draft.yaml | 2 ++ 2 files changed, 22 insertions(+) create mode 100644 .github/workflows/defaults-smoketest.yml diff --git a/.github/workflows/defaults-smoketest.yml b/.github/workflows/defaults-smoketest.yml new file mode 100644 index 00000000..f5f2dacc --- /dev/null +++ b/.github/workflows/defaults-smoketest.yml @@ -0,0 +1,20 @@ +name: Draft Defaults Smoke Test +on: + pull_request: + branches: [ main ] + +jobs: +# Validate that `create` can successfully execute with default values + create-defaults-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.18.2 + - name: make + run: make + - name: Validate JSON + run: | + yes "" | ./draft \ No newline at end of file diff --git a/template/deployments/helm/draft.yaml b/template/deployments/helm/draft.yaml index 446a2d53..91774b75 100644 --- a/template/deployments/helm/draft.yaml +++ b/template/deployments/helm/draft.yaml @@ -23,3 +23,5 @@ variableDefaults: - name: "IMAGETAG" value: "latest" disablePrompt: true + - name: "APPNAME" + value: "myapp" From 641376aa142d3f1312d3da89faca3d7a5132b37c Mon Sep 17 00:00:00 2001 From: David Gamero Date: Fri, 21 Apr 2023 15:07:48 -0400 Subject: [PATCH 07/13] issue with piping yes --- .github/workflows/defaults-smoketest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/defaults-smoketest.yml b/.github/workflows/defaults-smoketest.yml index f5f2dacc..1c350334 100644 --- a/.github/workflows/defaults-smoketest.yml +++ b/.github/workflows/defaults-smoketest.yml @@ -15,6 +15,6 @@ jobs: go-version: 1.18.2 - name: make run: make - - name: Validate JSON + - name: Validate Create Runs with Defaults run: | - yes "" | ./draft \ No newline at end of file + bash -c "yes || true" | | ./draft \ No newline at end of file From 5317aa54d19eca12fd839c38c1e3b5c04f428872 Mon Sep 17 00:00:00 2001 From: David Gamero Date: Fri, 21 Apr 2023 15:09:55 -0400 Subject: [PATCH 08/13] issue with piping yes --- .github/workflows/defaults-smoketest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/defaults-smoketest.yml b/.github/workflows/defaults-smoketest.yml index 1c350334..4c311810 100644 --- a/.github/workflows/defaults-smoketest.yml +++ b/.github/workflows/defaults-smoketest.yml @@ -17,4 +17,4 @@ jobs: run: make - name: Validate Create Runs with Defaults run: | - bash -c "yes || true" | | ./draft \ No newline at end of file + bash -c "yes || true" | ./draft \ No newline at end of file From 2b071b5d84e7e53d3ee096171b8f293c214ff1f1 Mon Sep 17 00:00:00 2001 From: David Gamero Date: Fri, 21 Apr 2023 17:00:56 -0400 Subject: [PATCH 09/13] issue with piping yes --- .github/workflows/defaults-smoketest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/defaults-smoketest.yml b/.github/workflows/defaults-smoketest.yml index 4c311810..a923b952 100644 --- a/.github/workflows/defaults-smoketest.yml +++ b/.github/workflows/defaults-smoketest.yml @@ -6,7 +6,7 @@ on: jobs: # Validate that `create` can successfully execute with default values create-defaults-test: - runs-on: ubuntu-latest + runs-on: macos-latest steps: - uses: actions/checkout@v3 - name: Set up Go @@ -17,4 +17,4 @@ jobs: run: make - name: Validate Create Runs with Defaults run: | - bash -c "yes || true" | ./draft \ No newline at end of file + yes "" | ./draft \ No newline at end of file From 72eb3c128934faaf04a70a6adc85e22eb08eb407 Mon Sep 17 00:00:00 2001 From: David Gamero Date: Fri, 21 Apr 2023 17:18:05 -0400 Subject: [PATCH 10/13] avoid yes broke pipe --- .github/workflows/defaults-smoketest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/defaults-smoketest.yml b/.github/workflows/defaults-smoketest.yml index a923b952..9ef70cd8 100644 --- a/.github/workflows/defaults-smoketest.yml +++ b/.github/workflows/defaults-smoketest.yml @@ -17,4 +17,4 @@ jobs: run: make - name: Validate Create Runs with Defaults run: | - yes "" | ./draft \ No newline at end of file + yes 2>/dev/null | ./draft \ No newline at end of file From 6ba809886cba1da75a4d1cc653bf493c6d7eb6cc Mon Sep 17 00:00:00 2001 From: David Gamero Date: Fri, 21 Apr 2023 17:40:27 -0400 Subject: [PATCH 11/13] avoid yes broke pipe --- .github/workflows/defaults-smoketest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/defaults-smoketest.yml b/.github/workflows/defaults-smoketest.yml index 9ef70cd8..0ba846f1 100644 --- a/.github/workflows/defaults-smoketest.yml +++ b/.github/workflows/defaults-smoketest.yml @@ -17,4 +17,4 @@ jobs: run: make - name: Validate Create Runs with Defaults run: | - yes 2>/dev/null | ./draft \ No newline at end of file + yes | ./draft \ No newline at end of file From a6eea8101e26196decf73a99809bf1d1f658d715 Mon Sep 17 00:00:00 2001 From: David Gamero Date: Mon, 24 Apr 2023 12:56:18 -0400 Subject: [PATCH 12/13] remove smoke test- couldnt get yes command to work :( --- .github/workflows/defaults-smoketest.yml | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 .github/workflows/defaults-smoketest.yml diff --git a/.github/workflows/defaults-smoketest.yml b/.github/workflows/defaults-smoketest.yml deleted file mode 100644 index 0ba846f1..00000000 --- a/.github/workflows/defaults-smoketest.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Draft Defaults Smoke Test -on: - pull_request: - branches: [ main ] - -jobs: -# Validate that `create` can successfully execute with default values - create-defaults-test: - runs-on: macos-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version: 1.18.2 - - name: make - run: make - - name: Validate Create Runs with Defaults - run: | - yes | ./draft \ No newline at end of file From 228932c9d3a93d8ce6fb585e30a7207c82844c62 Mon Sep 17 00:00:00 2001 From: David Gamero Date: Tue, 25 Apr 2023 14:40:57 -0400 Subject: [PATCH 13/13] remove new default --- template/deployments/helm/draft.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/template/deployments/helm/draft.yaml b/template/deployments/helm/draft.yaml index 91774b75..446a2d53 100644 --- a/template/deployments/helm/draft.yaml +++ b/template/deployments/helm/draft.yaml @@ -23,5 +23,3 @@ variableDefaults: - name: "IMAGETAG" value: "latest" disablePrompt: true - - name: "APPNAME" - value: "myapp"