diff --git a/.github/workflows/integration-linux.yml b/.github/workflows/integration-linux.yml index a66b797e..643f1c83 100644 --- a/.github/workflows/integration-linux.yml +++ b/.github/workflows/integration-linux.yml @@ -48,7 +48,7 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l gomodule --skip-file-detection --deploy-type helm --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest @@ -321,10 +321,10 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp - ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l gomodule --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest + ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l gomodule --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest - name: Validate JSON run: | npm install -g ajv-cli@5.0.0 @@ -486,7 +486,7 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l go --skip-file-detection --deploy-type helm --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest @@ -759,10 +759,10 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp - ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l go --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest + ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l go --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest - name: Validate JSON run: | npm install -g ajv-cli@5.0.0 @@ -924,10 +924,10 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp - ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l python --skip-file-detection --deploy-type helm --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest + ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l python --skip-file-detection --deploy-type helm --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest --variable ENTRYPOINT=testapp.py - name: Validate JSON run: | npm install -g ajv-cli@5.0.0 @@ -1068,7 +1068,7 @@ jobs: - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp - ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l python --skip-file-detection --deploy-type kustomize --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest + ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l python --skip-file-detection --deploy-type kustomize --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest --variable ENTRYPOINT=testapp.py - name: Validate JSON run: | npm install -g ajv-cli@5.0.0 @@ -1197,10 +1197,10 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp - ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l python --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest + ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l python --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest --variable ENTRYPOINT=testapp.py - name: Validate JSON run: | npm install -g ajv-cli@5.0.0 @@ -1362,7 +1362,7 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l rust --skip-file-detection --deploy-type helm --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest @@ -1635,10 +1635,10 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp - ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l rust --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest + ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l rust --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest - name: Validate JSON run: | npm install -g ajv-cli@5.0.0 @@ -1800,7 +1800,7 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l javascript --skip-file-detection --deploy-type helm --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest @@ -2073,10 +2073,10 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp - ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l javascript --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest + ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l javascript --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest - name: Validate JSON run: | npm install -g ajv-cli@5.0.0 @@ -2238,7 +2238,7 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l ruby --skip-file-detection --deploy-type helm --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest @@ -2511,10 +2511,10 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp - ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l ruby --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest + ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l ruby --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest - name: Validate JSON run: | npm install -g ajv-cli@5.0.0 @@ -2676,7 +2676,7 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l csharp --skip-file-detection --deploy-type helm --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest @@ -2949,10 +2949,10 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp - ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l csharp --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest + ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l csharp --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest - name: Validate JSON run: | npm install -g ajv-cli@5.0.0 @@ -3114,7 +3114,7 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l java --skip-file-detection --deploy-type helm --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest @@ -3387,10 +3387,10 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp - ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l java --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest + ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l java --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest - name: Validate JSON run: | npm install -g ajv-cli@5.0.0 @@ -3552,7 +3552,7 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l gradle --skip-file-detection --deploy-type helm --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest @@ -3825,10 +3825,10 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp - ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l gradle --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest + ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l gradle --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest - name: Validate JSON run: | npm install -g ajv-cli@5.0.0 @@ -3990,7 +3990,7 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l swift --skip-file-detection --deploy-type helm --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest @@ -4263,10 +4263,10 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp - ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l swift --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest + ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l swift --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest - name: Validate JSON run: | npm install -g ajv-cli@5.0.0 @@ -4428,7 +4428,7 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l erlang --skip-file-detection --deploy-type helm --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest @@ -4701,10 +4701,10 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp - ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l erlang --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest + ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l erlang --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest - name: Validate JSON run: | npm install -g ajv-cli@5.0.0 @@ -4866,7 +4866,7 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l clojure --skip-file-detection --deploy-type helm --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest @@ -5139,10 +5139,10 @@ jobs: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag + - name: Execute Dry Run with variables passed through flag run: | mkdir -p test/temp - ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l clojure --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest + ./draft --dry-run --dry-run-file test/temp/dry-run.json create -d ./langtest/ -l clojure --skip-file-detection --deploy-type manifests --variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest - name: Validate JSON run: | npm install -g ajv-cli@5.0.0 diff --git a/cmd/create.go b/cmd/create.go index 9c96e500..5fa7545b 100644 --- a/cmd/create.go +++ b/cmd/create.go @@ -260,12 +260,27 @@ func (cc *createCmd) generateDockerfile(langConfig *config.DraftConfig, lowerLan } // Extract language-specific defaults from repo - extractedDefaults, err := cc.supportedLangs.ExtractDefaults(lowerLang, cc.repoReader) + extractedValues, err := cc.supportedLangs.ExtractDefaults(lowerLang, cc.repoReader) if err != nil { return err } - for _, d := range extractedDefaults { - langConfig.VariableDefaults = append(langConfig.VariableDefaults, d) + + // Check for existing duplicate defualts + for k, v := range extractedValues { + variableExists := false + for i, varD := range langConfig.VariableDefaults { + if k == varD.Name { + variableExists = true + langConfig.VariableDefaults[i].Value = v + break + } + } + if !variableExists { + langConfig.VariableDefaults = append(langConfig.VariableDefaults, config.BuilderVarDefault{ + Name: k, + Value: v, + }) + } } var inputs map[string]string diff --git a/cmd/create_test.go b/cmd/create_test.go index 58380f2b..45343ca1 100644 --- a/cmd/create_test.go +++ b/cmd/create_test.go @@ -15,23 +15,15 @@ import ( "github.com/Azure/draft/pkg/config" "github.com/Azure/draft/pkg/languages" "github.com/Azure/draft/pkg/linguist" + "github.com/Azure/draft/pkg/reporeader" "github.com/Azure/draft/pkg/templatewriter/writers" "github.com/Azure/draft/template" ) func TestRun(t *testing.T) { - mockCC := &createCmd{} - mockCC.createConfig = &CreateConfig{} - mockCC.dest = "./.." - mockCC.createConfig.DeployType = "" - mockCC.createConfig.LanguageVariables = []UserInputs{} - mockCC.createConfig.DeployVariables = []UserInputs{} - mockPortInput := UserInputs{Name: "PORT", Value: "8080"} - mockAppNameInput := UserInputs{Name: "APPNAME", Value: "testingCreateCommand"} - mockCC.createConfig.DeployVariables = append(mockCC.createConfig.DeployVariables, mockPortInput, mockAppNameInput) - mockCC.createConfig.LanguageVariables = append(mockCC.createConfig.LanguageVariables, mockPortInput) - mockCC.templateWriter = &writers.LocalFSWriter{} + testCreateConfig := CreateConfig{LanguageVariables: []UserInputs{{Name: "PORT", Value: "8080"}}, DeployVariables: []UserInputs{{Name: "PORT", Value: "8080"}, {Name: "APPNAME", Value: "testingCreateCommand"}}} flagVariablesMap = map[string]string{"PORT": "8080", "APPNAME": "testingCreateCommand", "VERSION": "1.18", "SERVICEPORT": "8080", "NAMESPACE": "testNamespace", "IMAGENAME": "testImage", "IMAGETAG": "latest"} + mockCC := createCmd{dest: "./..", createConfig: &testCreateConfig, templateWriter: &writers.LocalFSWriter{}} deployTypes := []string{"helm", "kustomize", "manifests"} oldDockerfile, _ := ioutil.ReadFile("./../Dockerfile") oldDockerignore, _ := ioutil.ReadFile("./../.dockerignore") @@ -53,7 +45,6 @@ func TestRun(t *testing.T) { assert.False(t, lowerLang == "") assert.True(t, err == nil) err = mockCC.generateDockerfile(detectedLang, lowerLang) - println(err) assert.True(t, err == nil) //Write back old Dockerfile @@ -105,6 +96,40 @@ func TestRun(t *testing.T) { } } +func TestRunCreateDockerfileWithRepoReader(t *testing.T) { + + testRepoReader := &reporeader.TestRepoReader{Files: map[string][]byte{ + "foo.py": []byte("print('Hello World')"), + "main.py": []byte("print('Hello World')"), + }} + + testCreateConfig := CreateConfig{LanguageType: "python", LanguageVariables: []UserInputs{{Name: "PORT", Value: "8080"}}} + mockCC := createCmd{createConfig: &testCreateConfig, repoReader: testRepoReader, templateWriter: &writers.LocalFSWriter{}} + + detectedLang, lowerLang, err := mockCC.mockDetectLanguage() + assert.False(t, detectedLang == nil) + assert.True(t, lowerLang == "python") + assert.Nil(t, err) + + err = mockCC.generateDockerfile(detectedLang, lowerLang) + assert.True(t, err == nil) + + dockerFileContent, err := ioutil.ReadFile("Dockerfile") + if err != nil { + t.Error(err) + } + assert.Contains(t, string(dockerFileContent), "CMD [\"main.py\"]") + + err = os.Remove("Dockerfile") + if err != nil { + t.Error(err) + } + err = os.RemoveAll(".dockerignore") + if err != nil { + t.Error(err) + } +} + func TestInitConfig(t *testing.T) { mockCC := &createCmd{} mockCC.createConfig = &CreateConfig{} diff --git a/pkg/languages/defaults/python.go b/pkg/languages/defaults/python.go index 98ac496e..45fbe64d 100644 --- a/pkg/languages/defaults/python.go +++ b/pkg/languages/defaults/python.go @@ -2,6 +2,8 @@ package defaults import ( "fmt" + "path/filepath" + "regexp" "github.com/Azure/draft/pkg/reporeader" ) @@ -12,12 +14,38 @@ type PythonExtractor struct { // ReadDefaults reads the default values for the language from the repo files func (p PythonExtractor) ReadDefaults(r reporeader.RepoReader) (map[string]string, error) { extractedValues := make(map[string]string) + // Find files with .py extension in the root of the repository or upto depth 0 files, err := r.FindFiles(".", []string{"*.py"}, 0) if err != nil { return nil, fmt.Errorf("error finding python files: %v", err) } - if len(files) > 0 { - extractedValues["ENTRYPOINT"] = files[0] + // Regex for python entrypoint pattern `if __name__ == '__main__'` + entryPointPattern := `if\s*__name__\s*==\s*["']__main__["']` + compiledPattern, err := regexp.Compile(entryPointPattern) + if err != nil { + return nil, fmt.Errorf("error compiling regex pattern: %v", err) + } + + for _, filePath := range files { + fileContent, err := r.ReadFile(filePath) + baseFile := filepath.Base(filePath) + + if err != nil { + return nil, fmt.Errorf(("error reading python files")) + } + fileContentInString := string(fileContent) + // Check if file contains python entrypoint pattern or name of the file is 'main.py' or 'app.py' + if compiledPattern.MatchString(fileContentInString) || baseFile == "main.py" || baseFile == "app.py" { + extractedValues["ENTRYPOINT"] = baseFile + break + } + } + + // Set entrypoint to the first .py file if other conditions do not match + if _, ok := extractedValues["ENTRYPOINT"]; !ok { + if len(files) > 0 { + extractedValues["ENTRYPOINT"] = files[0] + } } return extractedValues, nil diff --git a/pkg/languages/defaults/python_test.go b/pkg/languages/defaults/python_test.go index 9e636c5b..99fd70a9 100644 --- a/pkg/languages/defaults/python_test.go +++ b/pkg/languages/defaults/python_test.go @@ -65,7 +65,53 @@ func TestPythonExtractor_ReadDefaults(t *testing.T) { "ENTRYPOINT": "foo.py", }, wantErr: false, - }, { + }, + { + name: "extract python file containing the string \"if __name__ == '__main__'\" as the entrypoint", + args: args{ + r: reporeader.TestRepoReader{ + Files: map[string][]byte{ + "foo.py": []byte("print('hello world')"), + "bar.py": []byte("if __name__ == '__main__' : print('hello world')"), + }, + }, + }, + want: map[string]string{ + "ENTRYPOINT": "bar.py", + }, + wantErr: false, + }, + { + name: "extract python file containing the string \"if __name__==\"__main__\"\" as the entrypoint", + args: args{ + r: reporeader.TestRepoReader{ + Files: map[string][]byte{ + "foo.py": []byte("print('hello world')"), + "bar.py": []byte("if __name__==\"__main__\": print('hello world')"), + }, + }, + }, + want: map[string]string{ + "ENTRYPOINT": "bar.py", + }, + wantErr: false, + }, + { + name: "extract python file named app.py as the entrypoint", + args: args{ + r: reporeader.TestRepoReader{ + Files: map[string][]byte{ + "foo.py": []byte("print('Hello World')"), + "app.py": []byte("print('Hello World')"), + }, + }, + }, + want: map[string]string{ + "ENTRYPOINT": "app.py", + }, + wantErr: false, + }, + { name: "no extraction if no python files", args: args{ r: reporeader.TestRepoReader{ diff --git a/pkg/languages/languages.go b/pkg/languages/languages.go index b709e5fd..64369ad7 100644 --- a/pkg/languages/languages.go +++ b/pkg/languages/languages.go @@ -117,16 +117,15 @@ func CreateLanguagesFromEmbedFS(dockerfileTemplates embed.FS, dest string) *Lang return l } -func (l *Languages) ExtractDefaults(lowerLang string, r reporeader.RepoReader) ([]config.BuilderVarDefault, error) { +func (l *Languages) ExtractDefaults(lowerLang string, r reporeader.RepoReader) (map[string]string, error) { extractors := []reporeader.VariableExtractor{ &defaults.PythonExtractor{}, &defaults.GradleExtractor{}, } extractedValues := make(map[string]string) - var extractedDefaults []config.BuilderVarDefault if r == nil { log.Debugf("no repo reader provided, returning empty list of defaults") - return extractedDefaults, nil + return extractedValues, nil } for _, extractor := range extractors { if extractor.MatchesLanguage(lowerLang) { @@ -144,12 +143,5 @@ func (l *Languages) ExtractDefaults(lowerLang string, r reporeader.RepoReader) ( } } - for k, v := range extractedValues { - extractedDefaults = append(extractedDefaults, config.BuilderVarDefault{ - Name: k, - Value: v, - }) - } - - return extractedDefaults, nil + return extractedValues, nil } diff --git a/template/dockerfiles/python/Dockerfile b/template/dockerfiles/python/Dockerfile index 985a8640..9516b0c4 100644 --- a/template/dockerfiles/python/Dockerfile +++ b/template/dockerfiles/python/Dockerfile @@ -9,4 +9,4 @@ RUN pip install --no-cache-dir -r requirements.txt COPY . . ENTRYPOINT ["python"] -CMD ["app.py"] \ No newline at end of file +CMD ["{{ENTRYPOINT}}"] \ No newline at end of file diff --git a/template/dockerfiles/python/draft.yaml b/template/dockerfiles/python/draft.yaml index 831d9b95..7d361ed1 100644 --- a/template/dockerfiles/python/draft.yaml +++ b/template/dockerfiles/python/draft.yaml @@ -10,8 +10,14 @@ variables: - name: "VERSION" description: "the version of python used by the application" exampleValues: ["3.9", "3.8", "3.7", "3.6"] + - name: "ENTRYPOINT" + description: "the entrypoint file of the repository" + type: string + exampleValues: ["app.py", "main.py"] variableDefaults: - name: "VERSION" value: "3" - name: "PORT" value: "80" + - name: "ENTRYPOINT" + value: "app.py" diff --git a/test/gen_integration.sh b/test/gen_integration.sh index 7868ac6e..07665d70 100755 --- a/test/gen_integration.sh +++ b/test/gen_integration.sh @@ -109,6 +109,7 @@ do # addon integration testing vars ingress_test_args="-a webapp_routing --variable ingress-tls-cert-keyvault-uri=test.cert.keyvault.uri --variable ingress-use-osm-mtls=true --variable ingress-host=host1" create_config_args="--variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest" + python_create_config_args="--variable PORT=8080 --variable APPNAME=testingCreateCommand --variable VERSION=1.11 --variable BUILDERVERSION=1.11 --variable SERVICEPORT=8080 --variable NAMESPACE=testNamespace --variable IMAGENAME=testImage --variable IMAGETAG=latest --variable ENTRYPOINT=testapp.py" echo "Adding $lang with port $port" mkdir ./integration/$lang @@ -204,12 +205,19 @@ languageVariables: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag - run: | + - name: Execute Dry Run with variables passed through flag + $(if [ "$lang" = "python" ] + then echo "run: | + mkdir -p test/temp + ./draft --dry-run --dry-run-file test/temp/dry-run.json \ + create -d ./langtest/ -l $lang --skip-file-detection --deploy-type helm \ + $python_create_config_args" + else echo "run: | mkdir -p test/temp ./draft --dry-run --dry-run-file test/temp/dry-run.json \ create -d ./langtest/ -l $lang --skip-file-detection --deploy-type helm \ - $create_config_args + $create_config_args" + fi) - name: Validate JSON run: | npm install -g ajv-cli@5.0.0 @@ -355,11 +363,18 @@ languageVariables: npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - name: Execute Dry Run with variables passed through flag - run: | + $(if [ "$lang" = "python" ]; + then echo "run: | + mkdir -p test/temp + ./draft --dry-run --dry-run-file test/temp/dry-run.json \ + create -d ./langtest/ -l $lang --skip-file-detection --deploy-type kustomize \ + $python_create_config_args"; + else echo "run: | mkdir -p test/temp ./draft --dry-run --dry-run-file test/temp/dry-run.json \ create -d ./langtest/ -l $lang --skip-file-detection --deploy-type kustomize \ - $create_config_args + $create_config_args"; + fi) - name: Validate JSON run: | npm install -g ajv-cli@5.0.0 @@ -495,12 +510,19 @@ languageVariables: run: | npm install -g ajv-cli@5.0.0 ajv validate -s test/dry_run_schema.json -d test/temp/dry-run.json - - name: Execute Dry Run with variables passed through flag - run: | + - name: Execute Dry Run with variables passed through flag + $(if [ "$lang" = "python" ]; + then echo "run: | + mkdir -p test/temp + ./draft --dry-run --dry-run-file test/temp/dry-run.json \ + create -d ./langtest/ -l $lang --skip-file-detection --deploy-type manifests \ + $python_create_config_args"; + else echo "run: | mkdir -p test/temp ./draft --dry-run --dry-run-file test/temp/dry-run.json \ create -d ./langtest/ -l $lang --skip-file-detection --deploy-type manifests \ - $create_config_args + $create_config_args"; + fi) - name: Validate JSON run: | npm install -g ajv-cli@5.0.0