diff --git a/.gitignore b/.gitignore index 3cb0acd6..403d6213 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ .idea -cmd/test-resources/template-routes/output +test-resources/output diff --git a/cmd/helpers_values.go b/cmd/helpers_values.go index 2448b23e..e51a9639 100644 --- a/cmd/helpers_values.go +++ b/cmd/helpers_values.go @@ -8,6 +8,7 @@ import ( "strconv" "strings" + composetypes "github.com/compose-spec/compose-go/types" "github.com/uselagoon/build-deploy-tool/internal/helpers" "github.com/uselagoon/build-deploy-tool/internal/lagoon" "sigs.k8s.io/yaml" @@ -27,6 +28,7 @@ func collectBuildValues(debug bool, activeEnv, standbyEnv *bool, autogenRoutes *lagoon.RoutesV2, mainRoutes *lagoon.RoutesV2, activeStandbyRoutes *lagoon.RoutesV2, + ignoreNonStringKeyErrors bool, ) error { var err error // environment variables will override what is provided by flags @@ -60,12 +62,6 @@ func collectBuildValues(debug bool, activeEnv, standbyEnv *bool, _ = yaml.Unmarshal(s, &lYAML) } - lCompose := lagoon.Compose{} - // unmarshal the docker-compose.yml file - if err = lagoon.UnmarshaDockerComposeYAML(lYAML.DockerComposeYAML, &lCompose); err != nil { - return err - } - lagoonValues.Project = projectName lagoonValues.Environment = environmentName lagoonValues.EnvironmentType = environmentType @@ -121,17 +117,37 @@ func collectBuildValues(debug bool, activeEnv, standbyEnv *bool, json.Unmarshal([]byte(projectVariables), &projectVars) json.Unmarshal([]byte(environmentVariables), &envVars) mergedVariables := lagoon.MergeVariables(projectVars, envVars) + // collect a bunch of the default LAGOON_X based build variables that are injected into `lagoon-env` and make them available + configVars := collectBuildVariables(*lagoonValues) + // add the calculated build runtime variables into the existing variable slice + // this will later be used to add `runtime|global` scope into the `lagoon-env` configmap + *lagoonEnvVars = lagoon.MergeVariables(mergedVariables, configVars) + + composeVars := make(map[string]string) + for _, envvar := range *lagoonEnvVars { + // fmt.Println(envvar) + composeVars[envvar.Name] = envvar.Value + } // create the services map lagoonValues.Services = make(map[string]lagoon.ServiceValues) lagoonServiceTypes, _ := lagoon.GetLagoonVariable("LAGOON_SERVICE_TYPES", []string{"build"}, mergedVariables) + + // lCompose := composetypes.Project{} + // unmarshal the docker-compose.yml file + lCompose, err := lagoon.UnmarshaDockerComposeYAML(lYAML.DockerComposeYAML, ignoreNonStringKeyErrors, composeVars) + if err != nil { + return err + } + // fmt.Println(lCompose) + // convert docker-compose services to servicevalues - for csName, csValues := range lCompose.Services { - cService, err := composeToServiceValues(lYAML, lagoonValues, lagoonServiceTypes, csName, csValues) + for _, csValues := range lCompose.Services { + cService, err := composeToServiceValues(lYAML, lagoonValues, lagoonServiceTypes, csValues.Name, csValues) if err != nil { return err } - lagoonValues.Services[csName] = cService + lagoonValues.Services[csValues.Name] = cService } // create all the routes for this environment and store the primary and secondary routes into values @@ -152,14 +168,14 @@ func collectBuildValues(debug bool, activeEnv, standbyEnv *bool, } // collect a bunch of the default LAGOON_X based build variables that are injected into `lagoon-env` and make them available - configVars := collectBuildVariables(*lagoonValues) + configVars = collectBuildVariables(*lagoonValues) // add the calculated build runtime variables into the existing variable slice // this will later be used to add `runtime|global` scope into the `lagoon-env` configmap *lagoonEnvVars = lagoon.MergeVariables(mergedVariables, configVars) return nil } -func composeToServiceValues(lYAML *lagoon.YAML, lagoonValues *lagoon.BuildValues, lagoonServiceTypes *lagoon.EnvironmentVariable, csName string, csValues lagoon.Service) (lagoon.ServiceValues, error) { +func composeToServiceValues(lYAML *lagoon.YAML, lagoonValues *lagoon.BuildValues, lagoonServiceTypes *lagoon.EnvironmentVariable, csName string, csValues composetypes.ServiceConfig) (lagoon.ServiceValues, error) { lagoonType := lagoon.CheckServiceLagoonLabel(csValues.Labels, "lagoon.type") autogenEnabled := true // check if autogenerated routes are disabled diff --git a/cmd/identify_feature.go b/cmd/identify_feature.go index 22c47efd..563cdfc9 100644 --- a/cmd/identify_feature.go +++ b/cmd/identify_feature.go @@ -33,7 +33,7 @@ func IdentifyFeatureFlag(name string, debug bool) (string, error) { autogenRoutes := &lagoon.RoutesV2{} mainRoutes := &lagoon.RoutesV2{} activeStanbyRoutes := &lagoon.RoutesV2{} - err := collectBuildValues(debug, &activeEnv, &standbyEnv, &lagoonEnvVars, &lagoonValues, &lYAML, autogenRoutes, mainRoutes, activeStanbyRoutes) + err := collectBuildValues(debug, &activeEnv, &standbyEnv, &lagoonEnvVars, &lagoonValues, &lYAML, autogenRoutes, mainRoutes, activeStanbyRoutes, ignoreNonStringKeyErrors) if err != nil { return "", err } diff --git a/cmd/identify_feature_test.go b/cmd/identify_feature_test.go index 6d00d1a5..ed1da35b 100644 --- a/cmd/identify_feature_test.go +++ b/cmd/identify_feature_test.go @@ -55,8 +55,8 @@ func TestIdentifyFeatureFlag(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"},{"name":"LAGOON_FEATURE_FLAG_ROOTLESS_WORKLOAD","value":"enabled","scope":"build"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/single-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/identify-feature/alltest/lagoon.yml", + templatePath: "../test-resources/output", }, want: "enabled", }, @@ -75,8 +75,8 @@ func TestIdentifyFeatureFlag(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[{"name":"LAGOON_FEATURE_FLAG_ROOTLESS_WORKLOAD","value":"enabled","scope":"build"}]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/single-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/identify-feature/alltest/lagoon.yml", + templatePath: "../test-resources/output", }, want: "enabled", }, @@ -95,8 +95,8 @@ func TestIdentifyFeatureFlag(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/single-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/identify-feature/alltest/lagoon.yml", + templatePath: "../test-resources/output", }, vars: []struct { name string @@ -124,8 +124,8 @@ func TestIdentifyFeatureFlag(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/single-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/identify-feature/alltest/lagoon.yml", + templatePath: "../test-resources/output", }, vars: []struct { name string @@ -157,8 +157,8 @@ func TestIdentifyFeatureFlag(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"},{"name":"LAGOON_FEATURE_FLAG_ROOTLESS_WORKLOAD","value":"enabled","scope":"build"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/single-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/identify-feature/alltest/lagoon.yml", + templatePath: "../test-resources/output", }, vars: []struct { name string @@ -190,8 +190,8 @@ func TestIdentifyFeatureFlag(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"},{"name":"LAGOON_FEATURE_FLAG_ROOTLESS_WORKLOAD","value":"enabled","scope":"build"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/single-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/identify-feature/alltest/lagoon.yml", + templatePath: "../test-resources/output", }, vars: []struct { name string diff --git a/cmd/identify_ingress.go b/cmd/identify_ingress.go index 65dd2c9d..234bd700 100644 --- a/cmd/identify_ingress.go +++ b/cmd/identify_ingress.go @@ -59,7 +59,7 @@ func IdentifyPrimaryIngress(debug bool) (string, []string, []string, error) { autogenRoutes := &lagoon.RoutesV2{} mainRoutes := &lagoon.RoutesV2{} activeStanbyRoutes := &lagoon.RoutesV2{} - err := collectBuildValues(debug, &activeEnv, &standbyEnv, &lagoonEnvVars, &lagoonValues, &lYAML, autogenRoutes, mainRoutes, activeStanbyRoutes) + err := collectBuildValues(debug, &activeEnv, &standbyEnv, &lagoonEnvVars, &lagoonValues, &lYAML, autogenRoutes, mainRoutes, activeStanbyRoutes, ignoreNonStringKeyErrors) if err != nil { return "", []string{}, []string{}, err } diff --git a/cmd/identify_ingress_test.go b/cmd/identify_ingress_test.go index e0f443ef..4682e82d 100644 --- a/cmd/identify_ingress_test.go +++ b/cmd/identify_ingress_test.go @@ -53,8 +53,8 @@ func TestIdentifyRoute(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"},{"name":"LAGOON_FASTLY_SERVICE_IDS","value":"example.com:service-id:true:annotationscom","scope":"build"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/single-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/identify-ingress/test1/lagoon.yml", + templatePath: "../test-resources/output", }, want: "https://example.com", wantRemain: []string{"https://node-example-project-main.example.com", "https://example.com"}, @@ -75,8 +75,8 @@ func TestIdentifyRoute(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"},{"name":"LAGOON_FASTLY_SERVICE_IDS","value":"example.com:service-id:true","scope":"build"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/single-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/identify-ingress/test2/lagoon.yml", + templatePath: "../test-resources/output", }, want: "https://example.com", wantRemain: []string{"https://node-example-project-main.example.com", "https://example.com"}, @@ -97,8 +97,8 @@ func TestIdentifyRoute(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"},{"name":"LAGOON_FASTLY_SERVICE_ID","value":"service-id:true","scope":"build"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/single-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/identify-ingress/test3/lagoon.yml", + templatePath: "../test-resources/output", }, want: "https://example.com", wantRemain: []string{"https://node-example-project-main.example.com", "https://example.com"}, @@ -119,8 +119,8 @@ func TestIdentifyRoute(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/single-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/identify-ingress/test4/lagoon.yml", + templatePath: "../test-resources/output", }, want: "https://example.com", wantRemain: []string{"https://node-example-project-main.example.com", "https://example.com"}, @@ -141,8 +141,8 @@ func TestIdentifyRoute(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/polysite-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/identify-ingress/test5/lagoon.yml", + templatePath: "../test-resources/output", }, want: "https://multiproject1.com", wantRemain: []string{"https://node-multiproject1-multiproject.example.com", "https://multiproject1.com"}, @@ -163,8 +163,8 @@ func TestIdentifyRoute(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/polysite-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/identify-ingress/test6/lagoon.yml", + templatePath: "../test-resources/output", }, want: "https://multiproject2.com", wantRemain: []string{"https://node-multiproject2-multiproject.example.com", "https://multiproject2.com"}, @@ -185,8 +185,8 @@ func TestIdentifyRoute(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/multi-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/identify-ingress/test7/lagoon.yml", + templatePath: "../test-resources/output", }, want: "https://example.com", wantRemain: []string{"https://node-example-project-main.example.com", "https://example.com", "https://www.example.com"}, @@ -207,8 +207,8 @@ func TestIdentifyRoute(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/multi-lagoon2.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/identify-ingress/test8/lagoon.yml", + templatePath: "../test-resources/output", }, want: "https://customdomain-will-be-main-domain.com", wantRemain: []string{"https://node-example-project-branch-routes.example.com", "https://customdomain-will-be-main-domain.com", "https://customdomain-will-be-not-be-main-domain.com"}, @@ -230,8 +230,8 @@ func TestIdentifyRoute(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/activestandby-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/identify-ingress/test9/lagoon.yml", + templatePath: "../test-resources/output", }, want: "https://active.example.com", wantRemain: []string{"https://node-example-project-main.example.com", "https://main.example.com", "https://active.example.com"}, @@ -253,8 +253,8 @@ func TestIdentifyRoute(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/activestandby-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/identify-ingress/test10/lagoon.yml", + templatePath: "../test-resources/output", }, want: "https://standby.example.com", wantRemain: []string{"https://node-example-project-main2.example.com", "https://main2.example.com", "https://standby.example.com"}, @@ -276,8 +276,8 @@ func TestIdentifyRoute(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/noingress-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/identify-ingress/test11/lagoon.yml", + templatePath: "../test-resources/output", }, want: "https://node-example-project-no-ingress.example.com", wantRemain: []string{"https://node-example-project-no-ingress.example.com"}, @@ -299,8 +299,8 @@ func TestIdentifyRoute(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/prefixes-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/identify-ingress/test12/lagoon.yml", + templatePath: "../test-resources/output", }, want: "https://node-example-project-no-ingress.example.com", wantRemain: []string{ @@ -320,7 +320,7 @@ func TestIdentifyRoute(t *testing.T) { wantJSON: `{"primary":"https://node-example-project-no-ingress.example.com","secondary":["https://node-example-project-no-ingress.example.com","https://www.node-example-project-no-ingress.example.com","https://en.node-example-project-no-ingress.example.com","https://de.node-example-project-no-ingress.example.com","https://fi.node-example-project-no-ingress.example.com"],"autogenerated":["https://node-example-project-no-ingress.example.com","https://www.node-example-project-no-ingress.example.com","https://en.node-example-project-no-ingress.example.com","https://de.node-example-project-no-ingress.example.com","https://fi.node-example-project-no-ingress.example.com"]}`, }, { - name: "test12 no autogenerated routes", + name: "test13 no autogenerated routes", args: args{ alertContact: "alertcontact", statusPageID: "statuspageid", @@ -333,8 +333,8 @@ func TestIdentifyRoute(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/single-lagoon-noautogen.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/identify-ingress/test13/lagoon.yml", + templatePath: "../test-resources/output", }, want: "https://example.com", wantRemain: []string{"https://example.com"}, @@ -342,7 +342,7 @@ func TestIdentifyRoute(t *testing.T) { wantJSON: `{"primary":"https://example.com","secondary":["https://example.com"],"autogenerated":[]}`, }, { - name: "test13 only autogenerated route", + name: "test14 only autogenerated route", args: args{ alertContact: "alertcontact", statusPageID: "statuspageid", @@ -355,14 +355,36 @@ func TestIdentifyRoute(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/single-lagoon-onlyautogen.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/identify-ingress/test14/lagoon.yml", + templatePath: "../test-resources/output", }, want: "https://node-example-project-main.example.com", wantRemain: []string{"https://node-example-project-main.example.com"}, wantautoGen: []string{"https://node-example-project-main.example.com"}, wantJSON: `{"primary":"https://node-example-project-main.example.com","secondary":["https://node-example-project-main.example.com"],"autogenerated":["https://node-example-project-main.example.com"]}`, }, + { + name: "test15 only autogenerated route complex", + args: args{ + alertContact: "alertcontact", + statusPageID: "statuspageid", + projectName: "sales-customer-support", + environmentName: "develop", + environmentType: "development", + buildType: "branch", + lagoonVersion: "v2.7.x", + branch: "develop", + projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.ex1.example-web.com","scope":"internal_system"}]`, + envVars: `[]`, + secretPrefix: "fastly-api-", + lagoonYAML: "../test-resources/identify-ingress/test15/lagoon.yml", + templatePath: "../test-resources/output", + }, + want: "https://nginx-sales-customer-support-develop.ex1.example-web.com", + wantRemain: []string{"https://nginx-sales-customer-support-develop.ex1.example-web.com"}, + wantautoGen: []string{"https://nginx-sales-customer-support-develop.ex1.example-web.com"}, + wantJSON: `{"primary":"https://nginx-sales-customer-support-develop.ex1.example-web.com","secondary":["https://nginx-sales-customer-support-develop.ex1.example-web.com"],"autogenerated":["https://nginx-sales-customer-support-develop.ex1.example-web.com"]}`, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -387,6 +409,10 @@ func TestIdentifyRoute(t *testing.T) { if err != nil { t.Errorf("%v", err) } + err = os.Setenv("LAGOON_GIT_BRANCH", tt.args.branch) + if err != nil { + t.Errorf("%v", err) + } err = os.Setenv("PR_NUMBER", tt.args.prNumber) if err != nil { t.Errorf("%v", err) diff --git a/cmd/root.go b/cmd/root.go index 00815b60..ec983886 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -52,6 +52,13 @@ var identifyCmd = &cobra.Command{ Long: `Identify resources for Lagoon builds`, } +var validateCmd = &cobra.Command{ + Use: "validate", + Aliases: []string{"valid", "v"}, + Short: "Validate resources", + Long: `Validate resources for Lagoon builds`, +} + // Execute adds all child commands to the root command and sets flags appropriately. // This is called by main.main(). It only needs to happen once to the rootCmd. func Execute() { @@ -68,6 +75,7 @@ func init() { rootCmd.AddCommand(configCmd) rootCmd.AddCommand(taskCmd) rootCmd.AddCommand(identifyCmd) + rootCmd.AddCommand(validateCmd) rootCmd.Flags().StringVarP(&lagoonYml, "lagoon-yml", "l", ".lagoon.yml", "The .lagoon.yml file to read") @@ -107,7 +115,8 @@ func init() { "The fastly service ID to use") rootCmd.Flags().StringVarP(&fastlyAPISecretPrefix, "fastly-api-secret-prefix", "A", "fastly-api-", "The fastly secret prefix to use") - + rootCmd.Flags().BoolVarP(&ignoreNonStringKeyErrors, "ignore-non-string-key-errors", "", true, + "Ignore non-string-key docker-compose errors (true by default, subject to change).") } // initConfig reads in config file and ENV variables if set. diff --git a/cmd/tasks_run.go b/cmd/tasks_run.go index cd37237e..482fbc5e 100644 --- a/cmd/tasks_run.go +++ b/cmd/tasks_run.go @@ -3,12 +3,13 @@ package cmd import ( "errors" "fmt" - "github.com/spf13/cobra" - "github.com/uselagoon/build-deploy-tool/internal/lagoon" - "github.com/uselagoon/build-deploy-tool/internal/tasklib" "io/ioutil" "os" "strings" + + "github.com/spf13/cobra" + "github.com/uselagoon/build-deploy-tool/internal/lagoon" + "github.com/uselagoon/build-deploy-tool/internal/tasklib" ) var runPreRollout, runPostRollout, outOfClusterConfig bool @@ -67,7 +68,7 @@ func getEnvironmentInfo() (lagoon.YAML, tasklib.TaskEnvironment, error) { mainRoutes := new(lagoon.RoutesV2) activeStandbyRoutes := new(lagoon.RoutesV2) - err := collectBuildValues(false, &activeEnv, &standbyEnv, &lagoonEnvVars, &lagoonValues, &lYAML, autogenRoutes, mainRoutes, activeStandbyRoutes) + err := collectBuildValues(false, &activeEnv, &standbyEnv, &lagoonEnvVars, &lagoonValues, &lYAML, autogenRoutes, mainRoutes, activeStandbyRoutes, ignoreNonStringKeyErrors) if err != nil { return lagoon.YAML{}, nil, err } diff --git a/cmd/template_autogen_ingress.go b/cmd/template_autogen_ingress.go index 9bbabe33..2c9bff23 100644 --- a/cmd/template_autogen_ingress.go +++ b/cmd/template_autogen_ingress.go @@ -43,7 +43,7 @@ func AutogeneratedIngressGeneration(debug bool) error { autogenRoutes := &lagoon.RoutesV2{} mainRoutes := &lagoon.RoutesV2{} activeStandbyRoutes := &lagoon.RoutesV2{} - err := collectBuildValues(debug, &activeEnv, &standbyEnv, &lagoonEnvVars, &lagoonValues, &lYAML, autogenRoutes, mainRoutes, activeStandbyRoutes) + err := collectBuildValues(debug, &activeEnv, &standbyEnv, &lagoonEnvVars, &lagoonValues, &lYAML, autogenRoutes, mainRoutes, activeStandbyRoutes, ignoreNonStringKeyErrors) if err != nil { return err } diff --git a/cmd/template_autogen_ingress_test.go b/cmd/template_autogen_ingress_test.go index 5d0bb5b9..3308ddaa 100644 --- a/cmd/template_autogen_ingress_test.go +++ b/cmd/template_autogen_ingress_test.go @@ -54,11 +54,11 @@ func TestAutogeneratedIngressGeneration(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-autogenerated/single-lagoon.yml", - templatePath: "test-resources/template-autogenerated/output", + lagoonYAML: "../test-resources/template-autogenerated/test1/lagoon.yml", + templatePath: "../test-resources/template-autogenerated/output", }, emptyDir: false, - want: "test-resources/template-autogenerated/test1-results", + want: "../test-resources/template-autogenerated/test1-results", }, { name: "test2 no autogenerated routes but allow pullrequests", @@ -76,11 +76,11 @@ func TestAutogeneratedIngressGeneration(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-autogenerated/pr-lagoon.yml", - templatePath: "test-resources/template-autogenerated/output", + lagoonYAML: "../test-resources/template-autogenerated/test2/lagoon.yml", + templatePath: "../test-resources/template-autogenerated/output", }, emptyDir: false, - want: "test-resources/template-autogenerated/test2-results", + want: "../test-resources/template-autogenerated/test2-results", }, { name: "test3 autogenerated route but no pullrequests", @@ -98,8 +98,8 @@ func TestAutogeneratedIngressGeneration(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-autogenerated/pr2-lagoon.yml", - templatePath: "test-resources/template-autogenerated/output", + lagoonYAML: "../test-resources/template-autogenerated/test3/lagoon.yml", + templatePath: "../test-resources/template-autogenerated/output", }, emptyDir: true, want: "", @@ -118,11 +118,11 @@ func TestAutogeneratedIngressGeneration(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-autogenerated/single-lagoon.yml", - templatePath: "test-resources/template-autogenerated/output", + lagoonYAML: "../test-resources/template-autogenerated/test4/lagoon.yml", + templatePath: "../test-resources/template-autogenerated/output", }, emptyDir: false, - want: "test-resources/template-autogenerated/test4-results", + want: "../test-resources/template-autogenerated/test4-results", }, { name: "test5 autogenerated route short url", @@ -138,11 +138,11 @@ func TestAutogeneratedIngressGeneration(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}.${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-autogenerated/single-lagoon.yml", - templatePath: "test-resources/template-autogenerated/output", + lagoonYAML: "../test-resources/template-autogenerated/test5/lagoon.yml", + templatePath: "../test-resources/template-autogenerated/output", }, emptyDir: false, - want: "test-resources/template-autogenerated/test5-results", + want: "../test-resources/template-autogenerated/test5-results", }, { name: "test6 autogenerated routes but disabled by service label", @@ -158,8 +158,8 @@ func TestAutogeneratedIngressGeneration(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-autogenerated/autogentrue-servicefalse-lagoon.yml", - templatePath: "test-resources/template-autogenerated/output", + lagoonYAML: "../test-resources/template-autogenerated/test6/lagoon.yml", + templatePath: "../test-resources/template-autogenerated/output", }, emptyDir: true, want: "", @@ -178,11 +178,11 @@ func TestAutogeneratedIngressGeneration(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-autogenerated/autogenfalse-servicetrue-lagoon.yml", - templatePath: "test-resources/template-autogenerated/output", + lagoonYAML: "../test-resources/template-autogenerated/test7/lagoon.yml", + templatePath: "../test-resources/template-autogenerated/output", }, emptyDir: false, - want: "test-resources/template-autogenerated/test7-results", + want: "../test-resources/template-autogenerated/test7-results", }, { name: "test8 autogenerated routes with fastly", @@ -201,11 +201,11 @@ func TestAutogeneratedIngressGeneration(t *testing.T) { ]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-autogenerated/single-lagoon.yml", - templatePath: "test-resources/template-autogenerated/output", + lagoonYAML: "../test-resources/template-autogenerated/test8/lagoon.yml", + templatePath: "../test-resources/template-autogenerated/output", }, emptyDir: false, - want: "test-resources/template-autogenerated/test8-results", + want: "../test-resources/template-autogenerated/test8-results", }, { name: "test9 autogenerated routes with fastly specific domain", @@ -224,11 +224,11 @@ func TestAutogeneratedIngressGeneration(t *testing.T) { ]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-autogenerated/single-lagoon.yml", - templatePath: "test-resources/template-autogenerated/output", + lagoonYAML: "../test-resources/template-autogenerated/test9/lagoon.yml", + templatePath: "../test-resources/template-autogenerated/output", }, emptyDir: false, - want: "test-resources/template-autogenerated/test9-results", + want: "../test-resources/template-autogenerated/test9-results", }, { name: "test10 autogenerated routes with fastly and specific secret", @@ -247,11 +247,11 @@ func TestAutogeneratedIngressGeneration(t *testing.T) { ]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-autogenerated/single-lagoon.yml", - templatePath: "test-resources/template-autogenerated/output", + lagoonYAML: "../test-resources/template-autogenerated/test10/lagoon.yml", + templatePath: "../test-resources/template-autogenerated/output", }, emptyDir: false, - want: "test-resources/template-autogenerated/test10-results", + want: "../test-resources/template-autogenerated/test10-results", }, { name: "test11 autogenerated route development environment", @@ -267,11 +267,11 @@ func TestAutogeneratedIngressGeneration(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-autogenerated/single-lagoon.yml", - templatePath: "test-resources/template-autogenerated/output", + lagoonYAML: "../test-resources/template-autogenerated/test11/lagoon.yml", + templatePath: "../test-resources/template-autogenerated/output", }, emptyDir: false, - want: "test-resources/template-autogenerated/test11-results", + want: "../test-resources/template-autogenerated/test11-results", }, { name: "test12 autogenerated route development environment", @@ -287,11 +287,11 @@ func TestAutogeneratedIngressGeneration(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-autogenerated/insecure-single-lagoon.yml", - templatePath: "test-resources/template-autogenerated/output", + lagoonYAML: "../test-resources/template-autogenerated/test12/lagoon.yml", + templatePath: "../test-resources/template-autogenerated/output", }, emptyDir: false, - want: "test-resources/template-autogenerated/test12-results", + want: "../test-resources/template-autogenerated/test12-results", }, { name: "test13 autogenerated route development service type override", @@ -308,11 +308,11 @@ func TestAutogeneratedIngressGeneration(t *testing.T) { {"name":"LAGOON_SERVICE_TYPES","value":"node:node-persistent","scope":"build"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-autogenerated/single-lagoon-no-type.yml", - templatePath: "test-resources/template-autogenerated/output", + lagoonYAML: "../test-resources/template-autogenerated/test13/lagoon.yml", + templatePath: "../test-resources/template-autogenerated/output", }, emptyDir: false, - want: "test-resources/template-autogenerated/test13-results", + want: "../test-resources/template-autogenerated/test13-results", }, { name: "test14 autogenerated route development no service type override", @@ -328,8 +328,8 @@ func TestAutogeneratedIngressGeneration(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-autogenerated/single-lagoon-no-type.yml", - templatePath: "test-resources/template-autogenerated/output", + lagoonYAML: "../test-resources/template-autogenerated/test14/lagoon.yml", + templatePath: "../test-resources/template-autogenerated/output", }, emptyDir: true, want: "", @@ -348,11 +348,11 @@ func TestAutogeneratedIngressGeneration(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-autogenerated/single-lagoon-nginxphp.yml", - templatePath: "test-resources/template-autogenerated/output", + lagoonYAML: "../test-resources/template-autogenerated/test15/lagoon.yml", + templatePath: "../test-resources/template-autogenerated/output", }, emptyDir: false, - want: "test-resources/template-autogenerated/test15-results", + want: "../test-resources/template-autogenerated/test15-results", }, { name: "test16 autogenerated route development service type override", @@ -368,11 +368,11 @@ func TestAutogeneratedIngressGeneration(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-autogenerated/single-lagoon-nginxphp2.yml", - templatePath: "test-resources/template-autogenerated/output", + lagoonYAML: "../test-resources/template-autogenerated/test16/lagoon.yml", + templatePath: "../test-resources/template-autogenerated/output", }, emptyDir: false, - want: "test-resources/template-autogenerated/test16-results", + want: "../test-resources/template-autogenerated/test16-results", }, { name: "test17 autogenerated route development service type override", @@ -388,11 +388,11 @@ func TestAutogeneratedIngressGeneration(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}.${project}.${environment}.172.18.0.3.nip.io","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-autogenerated/drush-lagoon.yml", - templatePath: "test-resources/template-autogenerated/output", + lagoonYAML: "../test-resources/template-autogenerated/test17/lagoon.yml", + templatePath: "../test-resources/template-autogenerated/output", }, emptyDir: false, - want: "test-resources/template-autogenerated/test17-results", + want: "../test-resources/template-autogenerated/test17-results", }, } for _, tt := range tests { diff --git a/cmd/template_ingress.go b/cmd/template_ingress.go index 0f342bdd..a231efbd 100644 --- a/cmd/template_ingress.go +++ b/cmd/template_ingress.go @@ -43,7 +43,7 @@ func IngressTemplateGeneration(debug bool) error { autogenRoutes := &lagoon.RoutesV2{} mainRoutes := &lagoon.RoutesV2{} activeStandbyRoutes := &lagoon.RoutesV2{} - err := collectBuildValues(debug, &activeEnv, &standbyEnv, &lagoonEnvVars, &lagoonValues, &lYAML, autogenRoutes, mainRoutes, activeStandbyRoutes) + err := collectBuildValues(debug, &activeEnv, &standbyEnv, &lagoonEnvVars, &lagoonValues, &lYAML, autogenRoutes, mainRoutes, activeStandbyRoutes, ignoreNonStringKeyErrors) if err != nil { return err } diff --git a/cmd/template_ingress_test.go b/cmd/template_ingress_test.go index d5fdb0eb..7f97457c 100644 --- a/cmd/template_ingress_test.go +++ b/cmd/template_ingress_test.go @@ -51,10 +51,10 @@ func TestTemplateRoutes(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"},{"name":"LAGOON_FASTLY_SERVICE_IDS","value":"example.com:service-id:true:annotationscom","scope":"build"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/single-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/template-ingress/test1/lagoon.yml", + templatePath: "../test-resources/template-ingress/output", }, - want: "test-resources/template-ingress/test1-results", + want: "../test-resources/template-ingress/test1-results", }, { name: "test2 check LAGOON_FASTLY_SERVICE_IDS no secret and no values", @@ -70,10 +70,10 @@ func TestTemplateRoutes(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"},{"name":"LAGOON_FASTLY_SERVICE_IDS","value":"example.com:service-id:true","scope":"build"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/single-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/template-ingress/test2/lagoon.yml", + templatePath: "../test-resources/template-ingress/output", }, - want: "test-resources/template-ingress/test2-results", + want: "../test-resources/template-ingress/test2-results", }, { name: "test3 check LAGOON_FASTLY_SERVICE_ID no secret and no values", @@ -89,10 +89,10 @@ func TestTemplateRoutes(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"},{"name":"LAGOON_FASTLY_SERVICE_ID","value":"service-id:true","scope":"build"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/single-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/template-ingress/test3/lagoon.yml", + templatePath: "../test-resources/template-ingress/output", }, - want: "test-resources/template-ingress/test3-results", + want: "../test-resources/template-ingress/test3-results", }, { name: "test4 check no fastly and no values", @@ -108,10 +108,10 @@ func TestTemplateRoutes(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/single-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/template-ingress/test4/lagoon.yml", + templatePath: "../test-resources/template-ingress/output", }, - want: "test-resources/template-ingress/test4-results", + want: "../test-resources/template-ingress/test4-results", }, { name: "test5 multiproject1 no values", @@ -127,10 +127,10 @@ func TestTemplateRoutes(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/polysite-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/template-ingress/test5/lagoon.yml", + templatePath: "../test-resources/template-ingress/output", }, - want: "test-resources/template-ingress/test5-results", + want: "../test-resources/template-ingress/test5-results", }, { name: "test6 multiproject2 no values", @@ -146,10 +146,10 @@ func TestTemplateRoutes(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/polysite-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/template-ingress/test6/lagoon.yml", + templatePath: "../test-resources/template-ingress/output", }, - want: "test-resources/template-ingress/test6-results", + want: "../test-resources/template-ingress/test6-results", }, { name: "test7 multidomain no values", @@ -165,10 +165,10 @@ func TestTemplateRoutes(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/multi-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/template-ingress/test7/lagoon.yml", + templatePath: "../test-resources/template-ingress/output", }, - want: "test-resources/template-ingress/test7-results", + want: "../test-resources/template-ingress/test7-results", }, { name: "test8 multidomain no values", @@ -184,10 +184,10 @@ func TestTemplateRoutes(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/multi-lagoon2.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/template-ingress/test8/lagoon.yml", + templatePath: "../test-resources/template-ingress/output", }, - want: "test-resources/template-ingress/test8-results", + want: "../test-resources/template-ingress/test8-results", }, { name: "test9 active no values", @@ -204,10 +204,10 @@ func TestTemplateRoutes(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/activestandby-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/template-ingress/test9/lagoon.yml", + templatePath: "../test-resources/template-ingress/output", }, - want: "test-resources/template-ingress/test9-results", + want: "../test-resources/template-ingress/test9-results", }, { name: "test10 standby no values", @@ -224,10 +224,10 @@ func TestTemplateRoutes(t *testing.T) { projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`, envVars: `[]`, secretPrefix: "fastly-api-", - lagoonYAML: "test-resources/template-ingress/activestandby-lagoon.yml", - templatePath: "test-resources/template-ingress/output", + lagoonYAML: "../test-resources/template-ingress/test10/lagoon.yml", + templatePath: "../test-resources/template-ingress/output", }, - want: "test-resources/template-ingress/test10-results", + want: "../test-resources/template-ingress/test10-results", }, } for _, tt := range tests { diff --git a/cmd/test-resources/template-autogenerated/prefixes-lagoon.yml b/cmd/test-resources/template-autogenerated/prefixes-lagoon.yml deleted file mode 100644 index d741b6b2..00000000 --- a/cmd/test-resources/template-autogenerated/prefixes-lagoon.yml +++ /dev/null @@ -1,20 +0,0 @@ -docker-compose-yaml: test-resources/template-autogenerated/node-docker-compose.yml - -routes: - autogenerate: - prefixes: - - www - - de - - fr - - it - enabled: true - insecure: Redirect - -environment_variables: - git_sha: "true" - -environments: - main: - routes: - - node: - - example.com diff --git a/cmd/test-resources/template-ingress/single-lagoon-onlyautogen.yml b/cmd/test-resources/template-ingress/single-lagoon-onlyautogen.yml deleted file mode 100644 index e4509ef1..00000000 --- a/cmd/test-resources/template-ingress/single-lagoon-onlyautogen.yml +++ /dev/null @@ -1,5 +0,0 @@ -docker-compose-yaml: test-resources/template-ingress/docker-compose.yml - -environment_variables: - git_sha: "true" - diff --git a/cmd/validate_compose.go b/cmd/validate_compose.go new file mode 100644 index 00000000..650ae9fb --- /dev/null +++ b/cmd/validate_compose.go @@ -0,0 +1,44 @@ +package cmd + +import ( + "fmt" + "os" + + "github.com/spf13/cobra" + "github.com/uselagoon/build-deploy-tool/internal/lagoon" +) + +var ( + dockerComposeFile string + ignoreNonStringKeyErrors bool +) + +var validateDockerCompose = &cobra.Command{ + Use: "docker-compose", + Aliases: []string{"compose", "docker", "dc"}, + Short: "Verify docker-compose file for compatability with this tool", + Run: func(cmd *cobra.Command, args []string) { + // @TODO: ignoreNonStringKeyErrors is `true` by default because Lagoon doesn't enforce + // docker-compose compliance yet + err := ValidateDockerCompose(dockerComposeFile, ignoreNonStringKeyErrors) + if err != nil { + fmt.Println(fmt.Sprintf("There is an issue with the docker-compose file, see errors below\n%s", err.Error())) + os.Exit(1) + } + }, +} + +// ValidateDockerCompose validate a docker-compose file +func ValidateDockerCompose(file string, ignoreErrors bool) error { + _, err := lagoon.UnmarshaDockerComposeYAML(file, ignoreNonStringKeyErrors, map[string]string{}) + if err != nil { + return err + } + return nil +} + +func init() { + validateCmd.AddCommand(validateDockerCompose) + validateDockerCompose.Flags().StringVarP(&dockerComposeFile, "docker-compose", "d", "docker-compose.yml", + "The docker-compose.yml file to read.") +} diff --git a/cmd/validate_compose_test.go b/cmd/validate_compose_test.go new file mode 100644 index 00000000..fb590d1d --- /dev/null +++ b/cmd/validate_compose_test.go @@ -0,0 +1,71 @@ +package cmd + +import ( + "testing" +) + +func TestValidateDockerCompose(t *testing.T) { + type args struct { + file string + ignoreErrors bool + } + tests := []struct { + name string + args args + wantErr bool + wantErrMsg string + }{ + { + name: "test1 complex docker-compose", + args: args{ + file: "../test-resources/docker-compose/test3/docker-compose.yml", + }, + }, + { + name: "test2 complex docker-compose", + args: args{ + file: "../test-resources/docker-compose/test4/docker-compose.yml", + }, + }, + { + name: "test3 complex docker-compose", + args: args{ + file: "../test-resources/docker-compose/test5/docker-compose.yml", + }, + }, + { + name: "test4 complex docker-compose", + args: args{ + file: "../test-resources/docker-compose/test6/docker-compose.yml", + }, + }, + { + name: "test5 check an invalid docker-compose", + args: args{ + file: "../test-resources/docker-compose/test7/docker-compose.yml", + }, + wantErr: true, + wantErrMsg: "Non-string key in x-site-branch: ", + }, + { + name: "test6 check an invalid docker-compose (same as test5 but ignoring the errors)", + args: args{ + file: "../test-resources/docker-compose/test8/docker-compose.yml", + ignoreErrors: true, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if err := ValidateDockerCompose(tt.args.file, tt.args.ignoreErrors); err != nil { + if tt.wantErr { + if err.Error() != tt.wantErrMsg { + t.Errorf("ValidateDockerCompose() error = %v, wantErr %v", err, tt.wantErr) + } + } else { + t.Errorf("ValidateDockerCompose() error = %v, wantErr %v", err, tt.wantErr) + } + } + }) + } +} diff --git a/go.mod b/go.mod index 83097ec8..bc8bb0a0 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.17 require ( github.com/PaesslerAG/gval v1.1.2 + github.com/compose-spec/compose-go v1.2.7 github.com/google/go-cmp v0.5.7 github.com/spf13/cobra v1.4.0 k8s.io/api v0.23.6 @@ -14,21 +15,33 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect + github.com/distribution/distribution/v3 v3.0.0-20210316161203-a01c71e2477e // indirect + github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-units v0.4.0 // indirect github.com/go-logr/logr v1.2.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/google/gofuzz v1.1.0 // indirect github.com/googleapis/gnostic v0.5.5 // indirect - github.com/imdario/mergo v0.3.5 // indirect + github.com/imdario/mergo v0.3.13 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/mattn/go-shellwords v1.0.12 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/moby/spdystream v0.2.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/sirupsen/logrus v1.8.1 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/testify v1.7.1 // indirect + github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect + github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect + github.com/xeipuuv/gojsonschema v1.2.0 // indirect golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect + golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/text v0.3.7 // indirect @@ -39,10 +52,14 @@ require ( gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + gopkg.in/yaml.v3 v3.0.0 // indirect k8s.io/klog/v2 v2.30.0 // indirect k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect k8s.io/utils v0.0.0-20211116205334-6203023598ed // indirect sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect ) + +replace github.com/compose-spec/compose-go v1.2.7 => github.com/shreddedbacon/compose-go v0.0.0-20220610063019-17f447c8c1aa + +// replace github.com/compose-spec/compose-go v1.2.7 => ../../compose-spec/compose-go diff --git a/go.sum b/go.sum index c00c70ef..74238468 100644 --- a/go.sum +++ b/go.sum @@ -36,6 +36,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/go-autorest v10.8.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest/autorest v0.11.18/go.mod h1:dSiJPy22c3u0OtOKDNttNgqpNFY/GeWa7GH/Pz56QRA= github.com/Azure/go-autorest/autorest/adal v0.9.13/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M= @@ -52,7 +54,20 @@ github.com/PaesslerAG/jsonpath v0.1.0 h1:gADYeifvlqK3R3i2cR5B4DGgxLXIPb3TRTH1mGi github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= +github.com/aws/aws-sdk-go v1.34.9/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= +github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= +github.com/bshuster-repo/logrus-logstash-hook v1.0.0/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= +github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= +github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= +github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= @@ -66,7 +81,20 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= +github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/distribution/distribution/v3 v3.0.0-20210316161203-a01c71e2477e h1:n81KvOMrLZa+VWHwST7dun9f0G98X3zREHS1ztYzZKU= +github.com/distribution/distribution/v3 v3.0.0-20210316161203-a01c71e2477e/go.mod h1:xpWTC2KnJMiDLkoawhsPQcXjvwATEBcbq0xevG2YR9M= +github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= +github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw= +github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= +github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153 h1:yUdfgN0XgIJw7foRItutHYUIhlcKzcSf5vDpdhQAKTc= github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -76,6 +104,7 @@ github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5y github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -86,6 +115,9 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-logr/logr v1.2.0 h1:QK40JKJyMdUDz+h+xvCsru/bJhvG0UxvePV0ufL/AcE= @@ -94,6 +126,9 @@ github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34 github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -127,6 +162,7 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/gomodule/redigo v1.8.2/go.mod h1:P9dn9mFrCBvWhGE1wpxx6fgq7BAeLBk+UUUzlpkBYO0= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= @@ -167,6 +203,7 @@ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5m github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU= github.com/googleapis/gnostic v0.5.5 h1:9fHAtK0uDfpveeqqo1hkEZJcFvYXAiCN3UutL8F9xHw= github.com/googleapis/gnostic v0.5.5/go.mod h1:7+EbHbldMins07ALC74bsA81Ovc97DwqyJO1AENw9kA= +github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= @@ -175,17 +212,24 @@ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imdario/mergo v0.3.5 h1:JboBksRwiiAJWvIYJVo46AfV+IAIKZpfrSzVKj42R4Q= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= +github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= @@ -196,17 +240,27 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= +github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk= +github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8= github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= +github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= @@ -219,20 +273,46 @@ github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGV github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/shreddedbacon/compose-go v0.0.0-20220610063019-17f447c8c1aa h1:vVqWIv8lPg7H3GgSYAqOfVLT5MzFVr/WPxeXRWAGqbk= +github.com/shreddedbacon/compose-go v0.0.0-20220610063019-17f447c8c1aa/go.mod h1:Jl9L8zJrt4aGY1XAz03DvHAu8V3/f00TK+uJL4BayDU= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= @@ -240,11 +320,20 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= +github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= +github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= +github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -252,10 +341,12 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= @@ -296,6 +387,7 @@ golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -303,6 +395,7 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -356,20 +449,26 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -479,6 +578,7 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f h1:GGU+dLjvlC3qDwqYgL6UgRmHXhOOgns0bZu2Ty5mm6U= golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.0.0-20160322025152-9bf6e6e569ff/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -508,6 +608,7 @@ google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCID google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/cloud v0.0.0-20151119220103-975617b05ea8/go.mod h1:0H1ncTHf11KCFhTc/+EFRbzSCOZx+VUbRMk55Yv5MYk= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -548,6 +649,7 @@ google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -580,7 +682,9 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -601,8 +705,11 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools/v3 v3.2.0 h1:I0DwBVMGAx26dttAj1BtJLAkVGncrkkUXfJLC4Flt/I= +gotest.tools/v3 v3.2.0/go.mod h1:Mcr9QNxkg0uMvy/YElmo4SpXgJKWgQvYrT7Kw5RzJ1A= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/internal/lagoon/compose.go b/internal/lagoon/compose.go index c3309687..802e950d 100644 --- a/internal/lagoon/compose.go +++ b/internal/lagoon/compose.go @@ -1,21 +1,28 @@ package lagoon import ( - "fmt" - "os" - - "sigs.k8s.io/yaml" + "github.com/compose-spec/compose-go/cli" + "github.com/compose-spec/compose-go/loader" + composetypes "github.com/compose-spec/compose-go/types" ) // UnmarshaDockerComposeYAML unmarshal the lagoon.yml file into a YAML and map for consumption. -func UnmarshaDockerComposeYAML(file string, l *Compose) error { - rawYAML, err := os.ReadFile(file) +func UnmarshaDockerComposeYAML(file string, ignoreErrors bool, envvars map[string]string) (*composetypes.Project, error) { + options, err := cli.NewProjectOptions([]string{file}, + cli.WithResolvedPaths(false), + cli.WithLoadOptions( + loader.WithSkipValidation, + func(o *loader.Options) { + o.IgnoreNonStringKeyErrors = ignoreErrors + }, + ), + ) + options.Environment = envvars + l, err := cli.ProjectFromOptions(options) if err != nil { - return fmt.Errorf("couldn't read %v: %v", file, err) + return nil, err } - // docker-compose.yml - yaml.Unmarshal(rawYAML, l) - return nil + return l, nil } // CheckServiceLagoonLabel checks the labels in a compose service to see if the requested label exists, and returns the value if so diff --git a/internal/lagoon/compose_test.go b/internal/lagoon/compose_test.go index 140dc8a7..fb1a3252 100644 --- a/internal/lagoon/compose_test.go +++ b/internal/lagoon/compose_test.go @@ -9,109 +9,90 @@ import ( func TestUnmarshaDockerComposeYAML(t *testing.T) { type args struct { - file string - l *Compose + file string + ignoreErrors bool } tests := []struct { - name string - args args - wantErr bool - want *Compose + name string + args args + wantErr bool + wantErrMsg string + want string }{ { name: "test1 docker-compose drupal example", args: args{ - file: "test-resources/drupal-docker-compose.yml", - l: &Compose{}, - }, - want: &Compose{ - Services: map[string]Service{ - "cli": { - Build: ServiceBuild{ - Context: ".", - Dockerfile: "lagoon/cli.dockerfile", - }, - Labels: map[string]string{ - "lando.type": "php-cli-drupal", - "lagoon.persistent": "/app/web/sites/default/files/", - "lagoon.persistent.name": "nginx", - "lagoon.type": "cli-persistent", - }, - }, - "nginx": { - Build: ServiceBuild{ - Context: ".", - Dockerfile: "lagoon/nginx.dockerfile", - }, - Labels: map[string]string{ - "lando.type": "nginx-drupal", - "lagoon.persistent": "/app/web/sites/default/files/", - "lagoon.type": "nginx-php-persistent", - }, - }, - "php": { - Build: ServiceBuild{ - Context: ".", - Dockerfile: "lagoon/php.dockerfile", - }, - Labels: map[string]string{ - "lando.type": "php-fpm", - "lagoon.persistent": "/app/web/sites/default/files/", - "lagoon.name": "nginx", - "lagoon.type": "nginx-php-persistent", - }, - }, - "mariadb": { - Labels: map[string]string{ - "lando.type": "mariadb-drupal", - "lagoon.type": "mariadb", - }, - }, - "redis": { - Labels: map[string]string{ - "lando.type": "redis", - "lagoon.type": "redis", - }, - }, - "solr": { - Labels: map[string]string{ - "lando.type": "solr-drupal", - "lagoon.type": "solr", - }, - }, - }, + file: "../../test-resources/docker-compose/test1/docker-compose.yml", }, + want: `{"name":"test1","services":{"cli":{"build":{"context":".","dockerfile":"lagoon/cli.dockerfile"},"environment":{"LAGOON_ROUTE":"http://drupal9-example-advanced.docker.amazee.io"},"image":"drupal9-example-advanced-cli","labels":{"lagoon.persistent":"/app/web/sites/default/files/","lagoon.persistent.name":"nginx","lagoon.type":"cli-persistent","lando.type":"php-cli-drupal"},"networks":{"default":null},"user":"root","volumes":[{"type":"bind","source":".","target":"/app","bind":{"create_host_path":true}},{"type":"volume","source":"files","target":"/app/web/sites/default/files","volume":{}}],"volumes_from":["container:amazeeio-ssh-agent"]},"mariadb":{"environment":{"LAGOON_ROUTE":"http://drupal9-example-advanced.docker.amazee.io"},"image":"uselagoon/mariadb-10.5-drupal:latest","labels":{"lagoon.type":"mariadb","lando.type":"mariadb-drupal"},"networks":{"default":null},"ports":[{"mode":"ingress","target":3306,"protocol":"tcp"}],"user":"1000"},"nginx":{"build":{"context":".","dockerfile":"lagoon/nginx.dockerfile","args":{"CLI_IMAGE":"drupal9-example-advanced-cli"}},"depends_on":{"cli":{"condition":"service_started"}},"environment":{"LAGOON_LOCALDEV_URL":"http://drupal9-example-advanced.docker.amazee.io","LAGOON_ROUTE":"http://drupal9-example-advanced.docker.amazee.io"},"labels":{"lagoon.persistent":"/app/web/sites/default/files/","lagoon.type":"nginx-php-persistent","lando.type":"nginx-drupal"},"networks":{"amazeeio-network":null,"default":null},"user":"1000","volumes":[{"type":"bind","source":".","target":"/app","bind":{"create_host_path":true}},{"type":"volume","source":"files","target":"/app/web/sites/default/files","volume":{}}]},"php":{"build":{"context":".","dockerfile":"lagoon/php.dockerfile","args":{"CLI_IMAGE":"drupal9-example-advanced-cli"}},"depends_on":{"cli":{"condition":"service_started"}},"environment":{"LAGOON_ROUTE":"http://drupal9-example-advanced.docker.amazee.io"},"labels":{"lagoon.name":"nginx","lagoon.persistent":"/app/web/sites/default/files/","lagoon.type":"nginx-php-persistent","lando.type":"php-fpm"},"networks":{"default":null},"user":"1000","volumes":[{"type":"bind","source":".","target":"/app","bind":{"create_host_path":true}},{"type":"volume","source":"files","target":"/app/web/sites/default/files","volume":{}}]},"redis":{"environment":{"LAGOON_ROUTE":"http://drupal9-example-advanced.docker.amazee.io"},"image":"uselagoon/redis-5:latest","labels":{"lagoon.type":"redis","lando.type":"redis"},"networks":{"default":null},"ports":[{"mode":"ingress","target":6379,"protocol":"tcp"}],"user":"1000"},"solr":{"environment":{"LAGOON_ROUTE":"http://drupal9-example-advanced.docker.amazee.io"},"image":"uselagoon/solr-7.7-drupal:latest","labels":{"lagoon.type":"solr","lando.type":"solr-drupal"},"networks":{"default":null},"ports":[{"mode":"ingress","target":8983,"protocol":"tcp"}]}},"networks":{"amazeeio-network":{"name":"amazeeio-network","ipam":{},"external":true},"default":{"name":"test1_default","ipam":{},"external":false}},"volumes":{"files":{"name":"test1_files","external":false}}}`, }, { name: "test2 docker-compose node example", args: args{ - file: "test-resources/node-docker-compose.yml", - l: &Compose{}, + file: "../../test-resources/docker-compose/test2/docker-compose.yml", }, - want: &Compose{ - Services: map[string]Service{ - "node": { - Build: ServiceBuild{ - Context: ".", - Dockerfile: "node.dockerfile", - }, - Labels: map[string]string{ - "lagoon.type": "node", - }, - }, - }, + want: `{"name":"test2","services":{"node":{"build":{"context":".","dockerfile":"node.dockerfile"},"environment":{"LAGOON_LOCALDEV_HTTP_PORT":"3000","LAGOON_ROUTE":"http://node.docker.amazee.io"},"labels":{"lagoon.type":"node"},"networks":{"amazeeio-network":null,"default":null},"volumes":[{"type":"bind","source":".","target":"/app","bind":{"create_host_path":true}}]}},"networks":{"amazeeio-network":{"name":"amazeeio-network","ipam":{},"external":true},"default":{"name":"test2_default","ipam":{},"external":false}}}`, + }, + { + name: "test3 docker-compose complex", + args: args{ + file: "../../test-resources/docker-compose/test3/docker-compose.yml", + }, + want: `{"name":"test3","services":{"cli":{"build":{"context":".","dockerfile":".lagoon/cli.dockerfile","args":{"DOCKER_CLI_IMAGE_URI":"","ENVIRONMENT_TYPE_ID":""}},"container_name":"_cli","environment":{"ENVIRONMENT_TYPE_ID":"","LAGOON_ENVIRONMENT_TYPE":"","LAGOON_PROJECT":"","LAGOON_ROUTE":"http://","PHP_MEMORY_LIMIT":"768M","XDEBUG_ENABLE":""},"labels":{"lagoon.persistent":"/app/docroot/sites/default/files/","lagoon.persistent.name":"nginx","lagoon.type":"cli-persistent"},"networks":{"default":null},"user":"root","volumes":[{"type":"bind","source":"./.lagoon/scripts/bash_prompts.rc","target":"/home/.bashrc","bind":{"create_host_path":true}},{"type":"bind","source":"./.lagoon/scripts/color_grid.sh","target":"/home/color_grid.sh","bind":{"create_host_path":true}}],"volumes_from":["container:amazeeio-ssh-agent"]},"mariadb":{"container_name":"_db","environment":{"ENVIRONMENT_TYPE_ID":"","LAGOON_ENVIRONMENT_TYPE":"","LAGOON_PROJECT":"","LAGOON_ROUTE":"http://","PHP_MEMORY_LIMIT":"768M","XDEBUG_ENABLE":""},"image":"amazeeio/mariadb-drupal","labels":{"lagoon.type":"mariadb"},"networks":{"default":null},"ports":[{"mode":"ingress","target":3306,"protocol":"tcp"}],"volumes":[{"type":"volume","source":"mysql","target":"/var/lib/mysql","volume":{}}]},"nginx":{"build":{"context":".","dockerfile":".lagoon/nginx.dockerfile","args":{"CLI_IMAGE":"","DOCKER_NGINX_IMAGE_URI":"","LAGOON_GIT_BRANCH":""}},"container_name":"_nginx","depends_on":{"cli":{"condition":"service_started"}},"environment":{"ENVIRONMENT_TYPE_ID":"","LAGOON_ENVIRONMENT_TYPE":"","LAGOON_LOCALDEV_URL":"http://","LAGOON_PROJECT":"","LAGOON_ROUTE":"http://","PHP_MEMORY_LIMIT":"768M","XDEBUG_ENABLE":""},"labels":{"lagoon.name":"nginx","lagoon.persistent":"/app/docroot/sites/default/files/","lagoon.type":"nginx-php-persistent"},"networks":{"amazeeio-network":null,"default":null},"volumes":[{"type":"bind","source":"./.lagoon/nginx/nginx-http.conf","target":"/etc/nginx/conf.d/000-nginx-http.conf","bind":{"create_host_path":true}},{"type":"bind","source":"./.lagoon/nginx/app.conf","target":"/etc/nginx/conf.d/app.conf","bind":{"create_host_path":true}}]},"php":{"build":{"context":".","dockerfile":".lagoon/php.dockerfile","args":{"CLI_IMAGE":"","DOCKER_PHP_IMAGE_URI":""}},"container_name":"_php","depends_on":{"cli":{"condition":"service_started"}},"environment":{"ENVIRONMENT_TYPE_ID":"","LAGOON_ENVIRONMENT_TYPE":"","LAGOON_PROJECT":"","LAGOON_ROUTE":"http://","PHP_MEMORY_LIMIT":"768M","XDEBUG_ENABLE":""},"labels":{"lagoon.deployment.servicetype":"php","lagoon.name":"nginx","lagoon.persistent":"/app/docroot/sites/default/files","lagoon.type":"nginx-php-persistent"},"networks":{"default":null}}},"networks":{"amazeeio-network":{"name":"amazeeio-network","ipam":{},"external":true},"default":{"name":"test3_default","ipam":{},"external":false}},"volumes":{"app":{"name":"test3_app","external":false},"mysql":{"name":"test3_mysql","external":false},"solr7":{"name":"test3_solr7","external":false}}}`, + }, + { + name: "test4 docker-compose complex", + args: args{ + file: "../../test-resources/docker-compose/test4/docker-compose.yml", + }, + want: `{"name":"test4","services":{"chrome":{"depends_on":{"cli":{"condition":"service_started"}},"environment":{"CKEDITOR_SCAYT_CUSTOMERID":"","CKEDITOR_SCAYT_SLANG":"","DB_ALIAS":"example.prod-left","DRUPAL_HASH_SALT":"fakehashsaltfakehashsaltfakehashsalt","DRUPAL_REFRESH_SEARCHAPI":"","EXAMPLE_IMAGE_VERSION":"latest","EXAMPLE_INGRESS_ENABLED":"","EXAMPLE_INGRESS_HEADER":"","EXAMPLE_INGRESS_PSK":"","EXAMPLE_KEY":"","GITHUB_TOKEN":"","LAGOON_ENVIRONMENT_TYPE":"local","LAGOON_LOCALDEV_URL":"http://mysite.docker.amazee.io","LAGOON_PROJECT":"mysite","LAGOON_ROUTE":"http://mysite.docker.amazee.io","PHP_MEMORY_LIMIT":"1024M","REDIS_CACHE_PREFIX":"tide_"},"image":"seleniarm/standalone-chromium:101.0","labels":{"lagoon.type":"none"},"networks":{"default":null},"shm_size":"1073741824","volumes":[{"type":"bind","source":".","target":"/app","bind":{"create_host_path":true}},{"type":"bind","source":"./docroot/sites/default/files","target":"/app/docroot/sites/default/files","bind":{"create_host_path":true}}]},"clamav":{"environment":{"CKEDITOR_SCAYT_CUSTOMERID":"","CKEDITOR_SCAYT_SLANG":"","DB_ALIAS":"example.prod-left","DRUPAL_HASH_SALT":"fakehashsaltfakehashsaltfakehashsalt","DRUPAL_REFRESH_SEARCHAPI":"","EXAMPLE_IMAGE_VERSION":"latest","EXAMPLE_INGRESS_ENABLED":"","EXAMPLE_INGRESS_HEADER":"","EXAMPLE_INGRESS_PSK":"","EXAMPLE_KEY":"","GITHUB_TOKEN":"","LAGOON_ENVIRONMENT_TYPE":"local","LAGOON_LOCALDEV_URL":"http://mysite.docker.amazee.io","LAGOON_PROJECT":"mysite","LAGOON_ROUTE":"http://mysite.docker.amazee.io","PHP_MEMORY_LIMIT":"1024M","REDIS_CACHE_PREFIX":"tide_"},"image":"clamav/example-clamav:4.x","labels":{"lagoon.type":"none"},"networks":{"default":null},"ports":[{"mode":"ingress","target":3310,"protocol":"tcp"}]},"cli":{"build":{"context":".","dockerfile":".docker/Dockerfile.cli","args":{"COMPOSER":"composer.json","EXAMPLE_IMAGE_VERSION":"4.x"}},"environment":{"CKEDITOR_SCAYT_CUSTOMERID":"","CKEDITOR_SCAYT_SLANG":"","DB_ALIAS":"example.prod-left","DRUPAL_HASH_SALT":"fakehashsaltfakehashsaltfakehashsalt","DRUPAL_REFRESH_SEARCHAPI":"","EXAMPLE_IMAGE_VERSION":"latest","EXAMPLE_INGRESS_ENABLED":"","EXAMPLE_INGRESS_HEADER":"","EXAMPLE_INGRESS_PSK":"","EXAMPLE_KEY":"","GITHUB_TOKEN":"","LAGOON_ENVIRONMENT_TYPE":"local","LAGOON_LOCALDEV_URL":"http://mysite.docker.amazee.io","LAGOON_PROJECT":"mysite","LAGOON_ROUTE":"http://mysite.docker.amazee.io","PHP_MEMORY_LIMIT":"1024M","REDIS_CACHE_PREFIX":"tide_"},"image":"mysite","labels":{"lagoon.persistent":"/app/docroot/sites/default/files/","lagoon.persistent.name":"nginx-php","lagoon.persistent.size":"50Gi","lagoon.type":"cli-persistent"},"networks":{"default":null},"volumes":[{"type":"bind","source":".","target":"/app","bind":{"create_host_path":true}},{"type":"bind","source":"./docroot/sites/default/files","target":"/app/docroot/sites/default/files","bind":{"create_host_path":true}}],"volumes_from":["container:amazeeio-ssh-agent"]},"elasticsearch":{"build":{"context":".","dockerfile":".docker/Dockerfile.elasticsearch","args":{"ES_TPL":"elasticsearch.yml"}},"labels":{"lagoon.type":"none"},"networks":{"default":null}},"mariadb":{"environment":{"CKEDITOR_SCAYT_CUSTOMERID":"","CKEDITOR_SCAYT_SLANG":"","DB_ALIAS":"example.prod-left","DRUPAL_HASH_SALT":"fakehashsaltfakehashsaltfakehashsalt","DRUPAL_REFRESH_SEARCHAPI":"","EXAMPLE_IMAGE_VERSION":"latest","EXAMPLE_INGRESS_ENABLED":"","EXAMPLE_INGRESS_HEADER":"","EXAMPLE_INGRESS_PSK":"","EXAMPLE_KEY":"","GITHUB_TOKEN":"","LAGOON_ENVIRONMENT_TYPE":"local","LAGOON_LOCALDEV_URL":"http://mysite.docker.amazee.io","LAGOON_PROJECT":"mysite","LAGOON_ROUTE":"http://mysite.docker.amazee.io","PHP_MEMORY_LIMIT":"1024M","REDIS_CACHE_PREFIX":"tide_"},"image":"uselagoon/mariadb-10.4-drupal:latest","labels":{"lagoon.type":"mariadb-shared"},"networks":{"default":null},"ports":[{"mode":"ingress","target":3306,"protocol":"tcp"}]},"nginx":{"build":{"context":".","dockerfile":".docker/Dockerfile.nginx-drupal","args":{"CLI_IMAGE":"mysite","EXAMPLE_IMAGE_VERSION":"4.x"}},"depends_on":{"cli":{"condition":"service_started"}},"environment":{"CKEDITOR_SCAYT_CUSTOMERID":"","CKEDITOR_SCAYT_SLANG":"","DB_ALIAS":"example.prod-left","DRUPAL_HASH_SALT":"fakehashsaltfakehashsaltfakehashsalt","DRUPAL_REFRESH_SEARCHAPI":"","EXAMPLE_IMAGE_VERSION":"latest","EXAMPLE_INGRESS_ENABLED":"","EXAMPLE_INGRESS_HEADER":"","EXAMPLE_INGRESS_PSK":"","EXAMPLE_KEY":"","GITHUB_TOKEN":"","LAGOON_ENVIRONMENT_TYPE":"local","LAGOON_LOCALDEV_URL":"http://mysite.docker.amazee.io","LAGOON_PROJECT":"mysite","LAGOON_ROUTE":"http://mysite.docker.amazee.io","PHP_MEMORY_LIMIT":"1024M","REDIS_CACHE_PREFIX":"tide_"},"expose":["8080"],"labels":{"lagoon.name":"nginx-php","lagoon.persistent":"/app/docroot/sites/default/files/","lagoon.persistent.size":"50Gi","lagoon.type":"nginx-php-persistent"},"networks":{"amazeeio-network":null,"default":null},"volumes":[{"type":"bind","source":".","target":"/app","bind":{"create_host_path":true}},{"type":"bind","source":"./docroot/sites/default/files","target":"/app/docroot/sites/default/files","bind":{"create_host_path":true}}]},"php":{"build":{"context":".","dockerfile":".docker/Dockerfile.php","args":{"CLI_IMAGE":"mysite","EXAMPLE_IMAGE_VERSION":"4.x"}},"depends_on":{"cli":{"condition":"service_started"}},"environment":{"CKEDITOR_SCAYT_CUSTOMERID":"","CKEDITOR_SCAYT_SLANG":"","DB_ALIAS":"example.prod-left","DRUPAL_HASH_SALT":"fakehashsaltfakehashsaltfakehashsalt","DRUPAL_REFRESH_SEARCHAPI":"","EXAMPLE_IMAGE_VERSION":"latest","EXAMPLE_INGRESS_ENABLED":"","EXAMPLE_INGRESS_HEADER":"","EXAMPLE_INGRESS_PSK":"","EXAMPLE_KEY":"","GITHUB_TOKEN":"","LAGOON_ENVIRONMENT_TYPE":"local","LAGOON_LOCALDEV_URL":"http://mysite.docker.amazee.io","LAGOON_PROJECT":"mysite","LAGOON_ROUTE":"http://mysite.docker.amazee.io","PHP_MEMORY_LIMIT":"1024M","REDIS_CACHE_PREFIX":"tide_"},"labels":{"lagoon.name":"nginx-php","lagoon.persistent":"/app/docroot/sites/default/files/","lagoon.persistent.size":"50Gi","lagoon.type":"nginx-php-persistent"},"networks":{"default":null},"volumes":[{"type":"bind","source":".","target":"/app","bind":{"create_host_path":true}},{"type":"bind","source":"./docroot/sites/default/files","target":"/app/docroot/sites/default/files","bind":{"create_host_path":true}}]},"redis":{"image":"uselagoon/redis-5:latest","labels":{"lagoon.type":"redis"},"networks":{"default":null}}},"networks":{"amazeeio-network":{"name":"amazeeio-network","ipam":{},"external":true},"default":{"name":"test4_default","ipam":{},"external":false}},"volumes":{"app":{"name":"test4_app","external":false},"files":{"name":"test4_files","external":false}}}`, + }, + { + name: "test5 docker-compose complex", + args: args{ + file: "../../test-resources/docker-compose/test5/docker-compose.yml", + }, + want: `{"name":"test5","services":{"chrome":{"depends_on":{"cli":{"condition":"service_started"}},"environment":{"CI":"","DOCKERHOST":"host.docker.internal","LAGOON_ENVIRONMENT_TYPE":"local","LAGOON_LOCALDEV_URL":"example-project.docker.amazee.io","LAGOON_PROJECT":"example-project","LAGOON_ROUTE":"example-project.docker.amazee.io","PHP_APC_SHM_SIZE":"256M","PHP_MAX_EXECUTION_TIME":"-1","PHP_MAX_INPUT_VARS":"4000","PHP_MEMORY_LIMIT":"2G","XDEBUG_ENABLE":""},"image":"selenium/standalone-chrome:3.141.59-oxygen","labels":{"lagoon.type":"none"},"networks":{"default":null},"shm_size":"1073741824","volumes":[{"type":"bind","source":".","target":"/app","bind":{"create_host_path":true}}]},"cli":{"build":{"context":".","dockerfile":".docker/Dockerfile.cli"},"environment":{"CI":"","DOCKERHOST":"host.docker.internal","LAGOON_ENVIRONMENT_TYPE":"local","LAGOON_LOCALDEV_URL":"example-project.docker.amazee.io","LAGOON_PROJECT":"example-project","LAGOON_ROUTE":"example-project.docker.amazee.io","PHP_APC_SHM_SIZE":"256M","PHP_MAX_EXECUTION_TIME":"-1","PHP_MAX_INPUT_VARS":"4000","PHP_MEMORY_LIMIT":"2G","XDEBUG_ENABLE":""},"image":"example-project","labels":{"lagoon.persistent":"/app/docroot/sites/default/files/","lagoon.persistent.name":"nginx-php","lagoon.type":"cli-persistent"},"networks":{"default":null},"ports":[{"mode":"ingress","target":35729,"protocol":"tcp"}],"user":"root","volumes":[{"type":"bind","source":".","target":"/app","bind":{"create_host_path":true}}],"volumes_from":["container:amazeeio-ssh-agent"]},"mariadb":{"build":{"context":".","dockerfile":".docker/Dockerfile.mariadb","args":{"IMAGE":"amazeeio/mariadb-drupal:21.7.0"}},"environment":{"CI":"","DOCKERHOST":"host.docker.internal","LAGOON_ENVIRONMENT_TYPE":"local","LAGOON_LOCALDEV_URL":"example-project.docker.amazee.io","LAGOON_PROJECT":"example-project","LAGOON_ROUTE":"example-project.docker.amazee.io","PHP_APC_SHM_SIZE":"256M","PHP_MAX_EXECUTION_TIME":"-1","PHP_MAX_INPUT_VARS":"4000","PHP_MEMORY_LIMIT":"2G","XDEBUG_ENABLE":""},"labels":{"lagoon.type":"mariadb"},"networks":{"default":null},"ports":[{"mode":"ingress","target":3306,"protocol":"tcp"}]},"nginx":{"build":{"context":".","dockerfile":".docker/Dockerfile.nginx-drupal","args":{"CLI_IMAGE":"example-project"}},"depends_on":{"cli":{"condition":"service_started"}},"environment":{"CI":"","DOCKERHOST":"host.docker.internal","LAGOON_ENVIRONMENT_TYPE":"local","LAGOON_LOCALDEV_URL":"example-project.docker.amazee.io","LAGOON_PROJECT":"example-project","LAGOON_ROUTE":"example-project.docker.amazee.io","PHP_APC_SHM_SIZE":"256M","PHP_MAX_EXECUTION_TIME":"-1","PHP_MAX_INPUT_VARS":"4000","PHP_MEMORY_LIMIT":"2G","XDEBUG_ENABLE":""},"labels":{"lagoon.name":"nginx-php","lagoon.persistent":"/app/docroot/sites/default/files/","lagoon.persistent.class":"slow","lagoon.type":"nginx-php-persistent"},"networks":{"amazeeio-network":null,"default":null},"user":"1000","volumes":[{"type":"bind","source":".","target":"/app","bind":{"create_host_path":true}}]},"php":{"build":{"context":".","dockerfile":".docker/Dockerfile.php","args":{"CLI_IMAGE":"example-project"}},"depends_on":{"cli":{"condition":"service_started"}},"environment":{"CI":"","DOCKERHOST":"host.docker.internal","LAGOON_ENVIRONMENT_TYPE":"local","LAGOON_LOCALDEV_URL":"example-project.docker.amazee.io","LAGOON_PROJECT":"example-project","LAGOON_ROUTE":"example-project.docker.amazee.io","PHP_APC_SHM_SIZE":"256M","PHP_MAX_EXECUTION_TIME":"-1","PHP_MAX_INPUT_VARS":"4000","PHP_MEMORY_LIMIT":"2G","XDEBUG_ENABLE":""},"labels":{"lagoon.name":"nginx-php","lagoon.persistent":"/app/docroot/sites/default/files/","lagoon.persistent.class":"slow","lagoon.type":"nginx-php-persistent"},"networks":{"default":null},"user":"1000","volumes":[{"type":"bind","source":".","target":"/app","bind":{"create_host_path":true}}]},"redis":{"environment":{"CI":"","DOCKERHOST":"host.docker.internal","LAGOON_ENVIRONMENT_TYPE":"local","LAGOON_LOCALDEV_URL":"example-project.docker.amazee.io","LAGOON_PROJECT":"example-project","LAGOON_ROUTE":"example-project.docker.amazee.io","PHP_APC_SHM_SIZE":"256M","PHP_MAX_EXECUTION_TIME":"-1","PHP_MAX_INPUT_VARS":"4000","PHP_MEMORY_LIMIT":"2G","XDEBUG_ENABLE":""},"image":"amazeeio/redis:6-21.11.0","labels":{"lagoon.type":"redis"},"networks":{"default":null}},"wait_dependencies":{"command":["mariadb:3306"],"depends_on":{"cli":{"condition":"service_started"},"mariadb":{"condition":"service_started"}},"image":"dadarek/wait-for-dependencies","labels":{"lagoon.type":"none"},"networks":{"default":null}}},"networks":{"amazeeio-network":{"name":"amazeeio-network","ipam":{},"external":true},"default":{"name":"test5_default","ipam":{},"external":false}},"volumes":{"app":{"name":"test5_app","external":false}}}`, + }, + { + name: "test6 docker-compose complex", + args: args{ + file: "../../test-resources/docker-compose/test6/docker-compose.yml", + }, + want: `{"name":"test6","services":{"chrome":{"depends_on":{"test":{"condition":"service_started"}},"image":"selenium/standalone-chrome","labels":{"lagoon.type":"none"},"networks":{"default":null},"shm_size":"1073741824","volumes":[{"type":"bind","source":"./themes","target":"/app/web/themes/custom","bind":{"create_host_path":true}},{"type":"bind","source":"./files","target":"/app/web/sites/default/files","bind":{"create_host_path":true}},{"type":"bind","source":"./tests/behat/features","target":"/app/tests/behat/features","bind":{"create_host_path":true}},{"type":"bind","source":"./tests/behat/screenshots","target":"/app/tests/behat/screenshots","bind":{"create_host_path":true}},{"type":"bind","source":"./tests/phpunit/tests","target":"/app/tests/phpunit/tests","bind":{"create_host_path":true}},{"type":"bind","source":"./config","target":"/app/config","bind":{"create_host_path":true}}]},"cli":{"build":{"context":".","dockerfile":".docker/Dockerfile.cli","args":{"EXAMPLE_IMAGE_VERSION":"9.x-latest","LAGOON_SAFE_PROJECT":"ca-learning2"}},"environment":{"DEV_MODE":"false","DOCKERHOST":"host.docker.internal","DRUPAL_SHIELD_PASS":"","DRUPAL_SHIELD_USER":"","EXAMPLE_DEPLOY_WORKFLOW_CONFIG":"import","EXAMPLE_IMAGE_VERSION":"9.x-latest","EXAMPLE_PREPARE_XML_SCRIPT":"/app/vendor/bin/example-prepare-xml","LAGOON_ENVIRONMENT_TYPE":"","LAGOON_PROJECT":"ca-learning2","LAGOON_ROUTE":"http://ca-learning2.docker.amazee.io","STAGE_FILE_PROXY_URL":"","XDEBUG_ENABLE":"","X_FRAME_OPTIONS":"SameOrigin"},"image":"ca-learning2","labels":{"lagoon.persistent":"/app/web/sites/default/files/","lagoon.persistent.name":"nginx","lagoon.type":"cli-persistent"},"networks":{"default":null},"volumes":[{"type":"bind","source":"./themes","target":"/app/web/themes/custom","bind":{"create_host_path":true}},{"type":"bind","source":"./files","target":"/app/web/sites/default/files","bind":{"create_host_path":true}},{"type":"bind","source":"./tests/behat/features","target":"/app/tests/behat/features","bind":{"create_host_path":true}},{"type":"bind","source":"./tests/behat/screenshots","target":"/app/tests/behat/screenshots","bind":{"create_host_path":true}},{"type":"bind","source":"./tests/phpunit/tests","target":"/app/tests/phpunit/tests","bind":{"create_host_path":true}},{"type":"bind","source":"./config","target":"/app/config","bind":{"create_host_path":true}}],"volumes_from":["container:amazeeio-ssh-agent"]},"mariadb":{"environment":{"DEV_MODE":"false","DOCKERHOST":"host.docker.internal","DRUPAL_SHIELD_PASS":"","DRUPAL_SHIELD_USER":"","EXAMPLE_DEPLOY_WORKFLOW_CONFIG":"import","EXAMPLE_IMAGE_VERSION":"9.x-latest","EXAMPLE_PREPARE_XML_SCRIPT":"/app/vendor/bin/example-prepare-xml","LAGOON_ENVIRONMENT_TYPE":"","LAGOON_PROJECT":"ca-learning2","LAGOON_ROUTE":"http://ca-learning2.docker.amazee.io","STAGE_FILE_PROXY_URL":"","XDEBUG_ENABLE":"","X_FRAME_OPTIONS":"SameOrigin"},"image":"example/mariadb-drupal:9.x-latest","labels":{"lagoon.image":"example/mariadb-drupal:9.x-latest","lagoon.type":"mariadb"},"networks":{"default":null},"ports":[{"mode":"ingress","target":3306,"protocol":"tcp"}]},"nginx":{"build":{"context":".","dockerfile":".docker/Dockerfile.nginx-drupal","args":{"CLI_IMAGE":"ca-learning2","EXAMPLE_IMAGE_VERSION":"9.x-latest"}},"depends_on":{"cli":{"condition":"service_started"}},"environment":{"DEV_MODE":"false","DOCKERHOST":"host.docker.internal","DRUPAL_SHIELD_PASS":"","DRUPAL_SHIELD_USER":"","EXAMPLE_DEPLOY_WORKFLOW_CONFIG":"import","EXAMPLE_IMAGE_VERSION":"9.x-latest","EXAMPLE_PREPARE_XML_SCRIPT":"/app/vendor/bin/example-prepare-xml","LAGOON_ENVIRONMENT_TYPE":"","LAGOON_LOCALDEV_URL":"http://ca-learning2.docker.amazee.io","LAGOON_PROJECT":"ca-learning2","LAGOON_ROUTE":"http://ca-learning2.docker.amazee.io","STAGE_FILE_PROXY_URL":"","XDEBUG_ENABLE":"","X_FRAME_OPTIONS":"SameOrigin"},"labels":{"lagoon.persistent":"/app/web/sites/default/files/","lagoon.type":"nginx-php-persistent"},"networks":{"amazeeio-network":null,"default":null},"volumes":[{"type":"bind","source":"./themes","target":"/app/web/themes/custom","bind":{"create_host_path":true}},{"type":"bind","source":"./files","target":"/app/web/sites/default/files","bind":{"create_host_path":true}},{"type":"bind","source":"./tests/behat/features","target":"/app/tests/behat/features","bind":{"create_host_path":true}},{"type":"bind","source":"./tests/behat/screenshots","target":"/app/tests/behat/screenshots","bind":{"create_host_path":true}},{"type":"bind","source":"./tests/phpunit/tests","target":"/app/tests/phpunit/tests","bind":{"create_host_path":true}},{"type":"bind","source":"./config","target":"/app/config","bind":{"create_host_path":true}}]},"php":{"build":{"context":".","dockerfile":".docker/Dockerfile.php","args":{"CLI_IMAGE":"ca-learning2","EXAMPLE_IMAGE_VERSION":"9.x-latest"}},"depends_on":{"cli":{"condition":"service_started"}},"environment":{"DEV_MODE":"false","DOCKERHOST":"host.docker.internal","DRUPAL_SHIELD_PASS":"","DRUPAL_SHIELD_USER":"","EXAMPLE_DEPLOY_WORKFLOW_CONFIG":"import","EXAMPLE_IMAGE_VERSION":"9.x-latest","EXAMPLE_PREPARE_XML_SCRIPT":"/app/vendor/bin/example-prepare-xml","LAGOON_ENVIRONMENT_TYPE":"","LAGOON_PROJECT":"ca-learning2","LAGOON_ROUTE":"http://ca-learning2.docker.amazee.io","STAGE_FILE_PROXY_URL":"","XDEBUG_ENABLE":"","X_FRAME_OPTIONS":"SameOrigin"},"labels":{"lagoon.name":"nginx","lagoon.persistent":"/app/web/sites/default/files/","lagoon.type":"nginx-php-persistent"},"networks":{"default":null},"volumes":[{"type":"bind","source":"./themes","target":"/app/web/themes/custom","bind":{"create_host_path":true}},{"type":"bind","source":"./files","target":"/app/web/sites/default/files","bind":{"create_host_path":true}},{"type":"bind","source":"./tests/behat/features","target":"/app/tests/behat/features","bind":{"create_host_path":true}},{"type":"bind","source":"./tests/behat/screenshots","target":"/app/tests/behat/screenshots","bind":{"create_host_path":true}},{"type":"bind","source":"./tests/phpunit/tests","target":"/app/tests/phpunit/tests","bind":{"create_host_path":true}},{"type":"bind","source":"./config","target":"/app/config","bind":{"create_host_path":true}}]},"test":{"build":{"context":".","dockerfile":".docker/Dockerfile.test","args":{"CLI_IMAGE":"ca-learning2","EXAMPLE_IMAGE_VERSION":"9.x-latest","SITE_AUDIT_VERSION":"7.x-3.x"}},"depends_on":{"cli":{"condition":"service_started"}},"environment":{"DEV_MODE":"false","DOCKERHOST":"host.docker.internal","DRUPAL_SHIELD_PASS":"","DRUPAL_SHIELD_USER":"","EXAMPLE_DEPLOY_WORKFLOW_CONFIG":"import","EXAMPLE_IMAGE_VERSION":"9.x-latest","EXAMPLE_PREPARE_XML_SCRIPT":"/app/vendor/bin/example-prepare-xml","LAGOON_ENVIRONMENT_TYPE":"","LAGOON_PROJECT":"ca-learning2","LAGOON_ROUTE":"http://ca-learning2.docker.amazee.io","STAGE_FILE_PROXY_URL":"","XDEBUG_ENABLE":"","X_FRAME_OPTIONS":"SameOrigin"},"labels":{"lagoon.type":"none"},"networks":{"default":null},"volumes":[{"type":"bind","source":"./themes","target":"/app/web/themes/custom","bind":{"create_host_path":true}},{"type":"bind","source":"./files","target":"/app/web/sites/default/files","bind":{"create_host_path":true}},{"type":"bind","source":"./tests/behat/features","target":"/app/tests/behat/features","bind":{"create_host_path":true}},{"type":"bind","source":"./tests/behat/screenshots","target":"/app/tests/behat/screenshots","bind":{"create_host_path":true}},{"type":"bind","source":"./tests/phpunit/tests","target":"/app/tests/phpunit/tests","bind":{"create_host_path":true}},{"type":"bind","source":"./config","target":"/app/config","bind":{"create_host_path":true}}]}},"networks":{"amazeeio-network":{"name":"amazeeio-network","ipam":{},"external":true},"default":{"name":"test6_default","ipam":{},"external":false}}}`, + }, + { + name: "test7 check an invalid docker-compose with ignoring non-string key errors", + args: args{ + file: "../../test-resources/docker-compose/test7/docker-compose.yml", + ignoreErrors: true, + }, + want: `{"name":"test7","services":{"cli":{"build":{"context":".","dockerfile":".lagoon/cli.dockerfile","args":{"DOCKER_CLI_IMAGE_URI":"","ENVIRONMENT_TYPE_ID":""}},"container_name":"_cli","environment":{"ENVIRONMENT_TYPE_ID":"","LAGOON_ENVIRONMENT_TYPE":"","LAGOON_PROJECT":"","LAGOON_ROUTE":"http://","PHP_MEMORY_LIMIT":"768M","XDEBUG_ENABLE":""},"labels":{"lagoon.persistent":"/app/docroot/sites/default/files/","lagoon.persistent.name":"nginx","lagoon.type":"cli-persistent"},"networks":{"default":null},"user":"root","volumes":[{"type":"bind","source":"./.lagoon/scripts/bash_prompts.rc","target":"/home/.bashrc","bind":{"create_host_path":true}},{"type":"bind","source":"./.lagoon/scripts/color_grid.sh","target":"/home/color_grid.sh","bind":{"create_host_path":true}}],"volumes_from":["container:amazeeio-ssh-agent"]},"mariadb":{"container_name":"_db","environment":{"ENVIRONMENT_TYPE_ID":"","LAGOON_ENVIRONMENT_TYPE":"","LAGOON_PROJECT":"","LAGOON_ROUTE":"http://","PHP_MEMORY_LIMIT":"768M","XDEBUG_ENABLE":""},"image":"amazeeio/mariadb-drupal","labels":{"lagoon.type":"mariadb"},"networks":{"default":null},"ports":[{"mode":"ingress","target":3306,"protocol":"tcp"}],"volumes":[{"type":"volume","source":"mysql","target":"/var/lib/mysql","volume":{}}]},"nginx":{"build":{"context":".","dockerfile":".lagoon/nginx.dockerfile","args":{"CLI_IMAGE":"","DOCKER_NGINX_IMAGE_URI":"","LAGOON_GIT_BRANCH":null}},"container_name":"_nginx","depends_on":{"cli":{"condition":"service_started"}},"environment":{"ENVIRONMENT_TYPE_ID":"","LAGOON_ENVIRONMENT_TYPE":"","LAGOON_LOCALDEV_URL":"http://","LAGOON_PROJECT":"","LAGOON_ROUTE":"http://","PHP_MEMORY_LIMIT":"768M","XDEBUG_ENABLE":""},"labels":{"lagoon.name":"nginx","lagoon.persistent":"/app/docroot/sites/default/files/","lagoon.type":"nginx-php-persistent"},"networks":{"amazeeio-network":null,"default":null},"volumes":[{"type":"bind","source":"./.lagoon/nginx/nginx-http.conf","target":"/etc/nginx/conf.d/000-nginx-http.conf","bind":{"create_host_path":true}},{"type":"bind","source":"./.lagoon/nginx/app.conf","target":"/etc/nginx/conf.d/app.conf","bind":{"create_host_path":true}}]},"php":{"build":{"context":".","dockerfile":".lagoon/php.dockerfile","args":{"CLI_IMAGE":"","DOCKER_PHP_IMAGE_URI":""}},"container_name":"_php","depends_on":{"cli":{"condition":"service_started"}},"environment":{"ENVIRONMENT_TYPE_ID":"","LAGOON_ENVIRONMENT_TYPE":"","LAGOON_PROJECT":"","LAGOON_ROUTE":"http://","PHP_MEMORY_LIMIT":"768M","XDEBUG_ENABLE":""},"labels":{"lagoon.deployment.servicetype":"php","lagoon.name":"nginx","lagoon.persistent":"/app/docroot/sites/default/files","lagoon.type":"nginx-php-persistent"},"networks":{"default":null}}},"networks":{"amazeeio-network":{"name":"amazeeio-network","ipam":{},"external":true},"default":{"name":"test7_default","ipam":{},"external":false}},"volumes":{"app":{"name":"test7_app","external":false},"mysql":{"name":"test7_mysql","external":false},"solr7":{"name":"test7_solr7","external":false}}}`, + }, + { + name: "test8 check an invalid docker-compose (same as test7 but not ignoring the errors)", + args: args{ + file: "../../test-resources/docker-compose/test8/docker-compose.yml", }, + wantErr: true, + wantErrMsg: "Non-string key in x-site-branch: ", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - if err := UnmarshaDockerComposeYAML(tt.args.file, tt.args.l); (err != nil) != tt.wantErr { + l, err := UnmarshaDockerComposeYAML(tt.args.file, tt.args.ignoreErrors, map[string]string{}) + if err != nil && !tt.wantErr { t.Errorf("UnmarshaDockerComposeYAML() error = %v, wantErr %v", err, tt.wantErr) } - if !cmp.Equal(tt.args.l, tt.want) { - stra, _ := json.Marshal(tt.args.l) - strb, _ := json.Marshal(tt.want) - t.Errorf("UnmarshaDockerComposeYAML() = %v, want %v", string(stra), string(strb)) + if tt.wantErr { + if err.Error() != tt.wantErrMsg { + t.Errorf("UnmarshaDockerComposeYAML() error = %v, wantErrMsg %v", err.Error(), tt.wantErrMsg) + } + } else { + stra, _ := json.Marshal(l) + if !cmp.Equal(string(stra), tt.want) { + t.Errorf("UnmarshaDockerComposeYAML() = %v, want %v", string(stra), tt.want) + } } }) } diff --git a/internal/lagoon/lagoon_test.go b/internal/lagoon/lagoon_test.go index 977617d6..36644b36 100644 --- a/internal/lagoon/lagoon_test.go +++ b/internal/lagoon/lagoon_test.go @@ -22,7 +22,7 @@ func TestUnmarshalLagoonYAML(t *testing.T) { { name: "test-booleans-represented-as-strings", args: args{ - file: "test-resources/lagoon-stringbooleans.yml", + file: "../../test-resources/lagoon-yaml/test1/lagoon.yml", l: &YAML{}, p: &map[string]interface{}{}, }, @@ -90,7 +90,7 @@ func TestUnmarshalLagoonYAML(t *testing.T) { { name: "test-booleans-represented-as-booleans", args: args{ - file: "test-resources/lagoon-booleans.yml", + file: "../../test-resources/lagoon-yaml/test2/lagoon.yml", l: &YAML{}, p: &map[string]interface{}{}, }, @@ -158,7 +158,7 @@ func TestUnmarshalLagoonYAML(t *testing.T) { { name: "test-booleans-represented-as-strings-and-booleans", args: args{ - file: "test-resources/lagoon-stringbooleans-combo.yml", + file: "../../test-resources/lagoon-yaml/test3/lagoon.yml", l: &YAML{}, p: &map[string]interface{}{}, }, diff --git a/internal/lagoon/test-resources/drupal-docker-compose.yml b/test-resources/docker-compose/test1/docker-compose.yml similarity index 100% rename from internal/lagoon/test-resources/drupal-docker-compose.yml rename to test-resources/docker-compose/test1/docker-compose.yml diff --git a/cmd/test-resources/template-ingress/docker-compose.yml b/test-resources/docker-compose/test2/docker-compose.yml similarity index 100% rename from cmd/test-resources/template-ingress/docker-compose.yml rename to test-resources/docker-compose/test2/docker-compose.yml diff --git a/test-resources/docker-compose/test3/docker-compose.yml b/test-resources/docker-compose/test3/docker-compose.yml new file mode 100644 index 00000000..022393cb --- /dev/null +++ b/test-resources/docker-compose/test3/docker-compose.yml @@ -0,0 +1,126 @@ +version: '2.3' + +x-lagoon-project: + # Lagoon project name (leave `&lagoon-project` when you edit this) + &lagoon-project $PROJECT_NAME + +x-environment: + &default-environment + # Environment ID + ENVIRONMENT_TYPE_ID: $ENVIRONMENT_TYPE_ID + # Machine name of the lagoon project. + LAGOON_PROJECT: *lagoon-project + # Route that should be used locally, if you are using pygmy, this route *must* end with .docker.amazee.io + LAGOON_ROUTE: &default-url http://$LAGOON_ROUTE + # Uncomment if you like to have the system behave like in production + LAGOON_ENVIRONMENT_TYPE: $LAGOON_ENVIRONMENT_TYPE + # The current Git branch of the Lagoon environment. + # LAGOON_GIT_BRANCH: $LAGOON_GIT_BRANCH + # Enable Xdebug within the .env file, then `make down` to reload the env. + XDEBUG_ENABLE: $XDEBUG_ENABLE + # The entrypoint script attempts to autodetect the DOCKERHOST for xdebug. + # If it fails to detect your host, the following override is available: + # DOCKERHOST: host.docker.internal + # Increase PHP memory limit. + PHP_MEMORY_LIMIT: 768M + +x-site-branch: + &site-branch $LAGOON_GIT_BRANCH + +x-user: + &default-user + user: $DEFAULT_USER_ID + +services: + + cli: # cli container, will be used for executing composer and any local commands (drush, drupal, etc.) + build: + context: . + dockerfile: .lagoon/cli.dockerfile + args: + ENVIRONMENT_TYPE_ID: ${ENVIRONMENT_TYPE_ID} + DOCKER_CLI_IMAGE_URI: ${DOCKER_CLI_IMAGE_URI} + image: *lagoon-project # this image will be reused as `CLI_IMAGE` in subsequent Docker builds + container_name: ${PROJECT_NAME}_cli + labels: + # Lagoon Labels + lagoon.type: cli-persistent + lagoon.persistent.name: nginx # mount the persistent storage of nginx into this container + lagoon.persistent: /app/docroot/sites/default/files/ # location where the persistent storage should be mounted + user: root + environment: + << : *default-environment # loads the defined environment variables from the top + volumes: + - ./.lagoon/scripts/bash_prompts.rc:/home/.bashrc + - ./.lagoon/scripts/color_grid.sh:/home/color_grid.sh + volumes_from: + - container:amazeeio-ssh-agent + + nginx: + build: + context: . + dockerfile: .lagoon/nginx.dockerfile + args: + CLI_IMAGE: *lagoon-project + DOCKER_NGINX_IMAGE_URI: ${DOCKER_NGINX_IMAGE_URI} + LAGOON_GIT_BRANCH: *site-branch + container_name: ${PROJECT_NAME}_nginx + labels: + lagoon.type: nginx-php-persistent + lagoon.persistent: /app/docroot/sites/default/files/ + lagoon.name: nginx + << : *default-user # uses the defined user from top + depends_on: + - cli # basically just tells docker-compose to build the cli first + environment: + << : *default-environment # loads the defined environment variables from the top + # LAGOON_LOCALDEV_URL: nginx-${LAGOON_ROUTE} + LAGOON_LOCALDEV_URL: *default-url + networks: + - amazeeio-network + - default + volumes: + - ./.lagoon/nginx/nginx-http.conf:/etc/nginx/conf.d/000-nginx-http.conf + - ./.lagoon/nginx/app.conf:/etc/nginx/conf.d/app.conf + + php: + build: + context: . + dockerfile: .lagoon/php.dockerfile + args: + CLI_IMAGE: *lagoon-project + DOCKER_PHP_IMAGE_URI: ${DOCKER_PHP_IMAGE_URI} + container_name: ${PROJECT_NAME}_php + labels: + lagoon.type: nginx-php-persistent + lagoon.persistent: /app/docroot/sites/default/files + lagoon.name: nginx + lagoon.deployment.servicetype: php + << : *default-user # uses the defined user from top + depends_on: + - cli # basically just tells docker-compose to build the cli first + environment: + << : *default-environment # loads the defined environment variables from the top + + mariadb: + image: amazeeio/mariadb-drupal + container_name: ${PROJECT_NAME}_db + labels: + lagoon.type: mariadb + ports: + - "3306" # exposes the port 3306 with a random local port, find it with `docker-compose port mariadb 3306` + << : *default-user # uses the defined user from top + environment: + << : *default-environment + volumes: + - mysql:/var/lib/mysql + +networks: + amazeeio-network: + external: true + +volumes: + app: + # Add a volume for the DB so it persists between shutdowns. + mysql: + solr7: \ No newline at end of file diff --git a/test-resources/docker-compose/test4/docker-compose.yml b/test-resources/docker-compose/test4/docker-compose.yml new file mode 100644 index 00000000..9c21b5f8 --- /dev/null +++ b/test-resources/docker-compose/test4/docker-compose.yml @@ -0,0 +1,146 @@ +version: '2.3' + +x-example-image-version: + &example-image-version ${EXAMPLE_IMAGE_VERSION:-4.x} + +x-project: + &project ${PROJECT_NAME:-mysite} + +x-volumes: + &default-volumes + volumes: + - .:/app:${VOLUME_FLAGS:-delegated} ### Local overrides to mount host filesystem. Automatically removed in CI and PROD. + - ./docroot/sites/default/files:/app/docroot/sites/default/files:${VOLUME_FLAGS:-delegated} ### Local overrides to mount host filesystem. Automatically removed in CI and PROD. + +x-environment: + &default-environment + LAGOON_PROJECT: *project + DRUPAL_HASH_SALT: fakehashsaltfakehashsaltfakehashsalt + # Local dev URL populated from the environment. Do not override here. Instead, + # specify the value in .env file. + LAGOON_LOCALDEV_URL: ${LOCALDEV_URL:-http://mysite.docker.amazee.io} + LAGOON_ROUTE: ${LOCALDEV_URL:-http://mysite.docker.amazee.io} + GITHUB_TOKEN: ${GITHUB_TOKEN:-} + EXAMPLE_KEY: ${EXAMPLE_KEY:-} + EXAMPLE_IMAGE_VERSION: ${EXAMPLE_IMAGE_VERSION:-latest} + LAGOON_ENVIRONMENT_TYPE: ${LAGOON_ENVIRONMENT_TYPE:-local} + DRUPAL_REFRESH_SEARCHAPI: ${DRUPAL_REFRESH_SEARCHAPI:-} + EXAMPLE_INGRESS_PSK: ${EXAMPLE_INGRESS_PSK:-} + EXAMPLE_INGRESS_HEADER: ${EXAMPLE_INGRESS_HEADER:-} + EXAMPLE_INGRESS_ENABLED: ${EXAMPLE_INGRESS_ENABLED:-} + REDIS_CACHE_PREFIX: "tide_" + DB_ALIAS: ${DB_ALIAS:-example.prod-left} + CKEDITOR_SCAYT_CUSTOMERID: ${CKEDITOR_SCAYT_CUSTOMERID:-} + CKEDITOR_SCAYT_SLANG: ${CKEDITOR_SCAYT_SLANG:-} + PHP_MEMORY_LIMIT: ${PHP_MEMORY_LIMIT:-1024M} + +services: + cli: + build: + context: . + dockerfile: .docker/Dockerfile.cli + args: + COMPOSER: ${COMPOSER:-composer.json} + EXAMPLE_IMAGE_VERSION: *example-image-version + image: *project + environment: + << : *default-environment + << : *default-volumes + volumes_from: ### Local overrides to mount host SSH keys. Automatically removed in CI. + - container:amazeeio-ssh-agent ### Local overrides to mount host SSH keys. Automatically removed in CI. + labels: + lagoon.type: cli-persistent + lagoon.persistent: /app/docroot/sites/default/files/ + lagoon.persistent.name: nginx-php + lagoon.persistent.size: 50Gi + + nginx: + build: + context: . + dockerfile: .docker/Dockerfile.nginx-drupal + args: + CLI_IMAGE: *project + EXAMPLE_IMAGE_VERSION: *example-image-version + << : *default-volumes + environment: + << : *default-environment + depends_on: + - cli + networks: + - amazeeio-network + - default + labels: + lagoon.type: nginx-php-persistent + lagoon.persistent: /app/docroot/sites/default/files/ + lagoon.persistent.size: 50Gi + lagoon.name: nginx-php + expose: + - "8080" + php: + build: + context: . + dockerfile: .docker/Dockerfile.php + args: + CLI_IMAGE: *project + EXAMPLE_IMAGE_VERSION: *example-image-version + environment: + << : *default-environment + << : *default-volumes + depends_on: + - cli + labels: + lagoon.type: nginx-php-persistent + lagoon.persistent: /app/docroot/sites/default/files/ + lagoon.persistent.size: 50Gi + lagoon.name: nginx-php + + mariadb: + image: uselagoon/mariadb-10.4-drupal:latest + environment: + << : *default-environment + ports: + - "3306" # Find port on host with `ahoy info` or `docker-compose port mariadb 3306` + labels: + lagoon.type: mariadb-shared + + redis: + image: uselagoon/redis-5:latest + labels: + lagoon.type: redis + + elasticsearch: + build: + context: . + dockerfile: .docker/Dockerfile.elasticsearch + args: + - ES_TPL=${ES_TPL:-elasticsearch.yml} + labels: + lagoon.type: none + + chrome: + image: seleniarm/standalone-chromium:101.0 + shm_size: '1gb' + environment: + << : *default-environment + << : *default-volumes + depends_on: + - cli + labels: + lagoon.type: none + + clamav: + image: clamav/example-clamav:${EXAMPLE_IMAGE_VERSION:-4.x} + environment: + << : *default-environment + ports: + - "3310" + labels: + lagoon.type: none + +networks: + amazeeio-network: + external: true + +volumes: + app: {} + files: {} \ No newline at end of file diff --git a/test-resources/docker-compose/test5/docker-compose.yml b/test-resources/docker-compose/test5/docker-compose.yml new file mode 100644 index 00000000..992a85ca --- /dev/null +++ b/test-resources/docker-compose/test5/docker-compose.yml @@ -0,0 +1,131 @@ +version: '2.3' + +x-project: + &project ${PROJECT:-example-project} + +x-volumes: + &default-volumes + volumes: + + - .:/app:${VOLUME_FLAGS:-delegated} ### Local overrides to mount host filesystem. Automatically removed in CI and PROD. +x-user: + &default-user + user: '1000' + +x-environment: + &default-environment + LAGOON_LOCALDEV_URL: &default-url ${LOCALDEV_URL:-example-project.docker.amazee.io} + LAGOON_ROUTE: *default-url + XDEBUG_ENABLE: ${XDEBUG_ENABLE:-} + CI: ${CI:-} + DOCKERHOST: ${DOCKERHOST:-host.docker.internal} + PHP_MEMORY_LIMIT: "2G" + PHP_APC_SHM_SIZE: "256M" + PHP_MAX_EXECUTION_TIME: -1 + PHP_MAX_INPUT_VARS: 4000 + + LAGOON_PROJECT: *project + + LAGOON_ENVIRONMENT_TYPE: ${LAGOON_ENVIRONMENT_TYPE:-local} + +services: + + cli: + build: + context: . + dockerfile: .docker/Dockerfile.cli + image: *project + <<: *default-volumes + user: root + environment: + <<: *default-environment + volumes_from: ### Local overrides to mount host SSH keys. Automatically removed in CI. + - container:amazeeio-ssh-agent ### Local overrides to mount host SSH keys. Automatically removed in CI. + ports: + - "35729" + labels: + lagoon.type: cli-persistent + lagoon.persistent.name: nginx-php + lagoon.persistent: /app/docroot/sites/default/files/ + nginx: + build: + context: . + dockerfile: .docker/Dockerfile.nginx-drupal + args: + CLI_IMAGE: *project + <<: *default-volumes + <<: *default-user + environment: + <<: *default-environment + depends_on: + - cli + networks: + - amazeeio-network + - default + labels: + lagoon.type: nginx-php-persistent + lagoon.name: nginx-php + lagoon.persistent: /app/docroot/sites/default/files/ + lagoon.persistent.class: slow + + php: + build: + context: . + dockerfile: .docker/Dockerfile.php + args: + CLI_IMAGE: *project + <<: *default-volumes + <<: *default-user + environment: + <<: *default-environment + depends_on: + - cli + labels: + lagoon.type: nginx-php-persistent + lagoon.name: nginx-php + lagoon.persistent: /app/docroot/sites/default/files/ + lagoon.persistent.class: slow + + mariadb: + build: + context: . + dockerfile: .docker/Dockerfile.mariadb + args: + IMAGE: "${DATABASE_IMAGE:-amazeeio/mariadb-drupal:21.7.0}" + environment: + <<: *default-environment + ports: + - "3306" + labels: + lagoon.type: mariadb + redis: + image: amazeeio/redis:6-21.11.0 + labels: + lagoon.type: redis + environment: + << : *default-environment + + chrome: + image: selenium/standalone-chrome:3.141.59-oxygen + shm_size: '1gb' + <<: *default-volumes + environment: + <<: *default-environment + depends_on: + - cli + labels: + lagoon.type: none + + wait_dependencies: + image: dadarek/wait-for-dependencies + depends_on: + - cli + - mariadb + command: mariadb:3306 + labels: + lagoon.type: none +networks: + amazeeio-network: + external: true +volumes: + app: {} \ No newline at end of file diff --git a/test-resources/docker-compose/test6/docker-compose.yml b/test-resources/docker-compose/test6/docker-compose.yml new file mode 100644 index 00000000..a3056e0f --- /dev/null +++ b/test-resources/docker-compose/test6/docker-compose.yml @@ -0,0 +1,138 @@ +version: '2.3' + +# This value intentionally matches the project name on Lagoon. +# It is used to name the CLI_IMAGE to use as a build arg locally. +x-lagoon-project: &lagoon-project + ca-learning2 + +x-lagoon-local-dev-url: &lagoon-local-dev-url + http://ca-learning2.docker.amazee.io + +x-example-image-version: &example-image-version + ${EXAMPLE_IMAGE_VERSION:-9.x-latest} + +x-volumes: &default-volumes + volumes: + - ./themes:/app/web/themes/custom:${VOLUME_FLAGS:-delegated} + - ./files:/app/web/sites/default/files:delegated + - ./tests/behat/features:/app/tests/behat/features:${VOLUME_FLAGS:-delegated} + - ./tests/behat/screenshots:/app/tests/behat/screenshots:${VOLUME_FLAGS:-delegated} + - ./tests/phpunit/tests:/app/tests/phpunit/tests:${VOLUME_FLAGS:-delegated} + - ./config:/app/config + +x-volumes-paas: &paas-volumes + volumes: + - .:/app:delegated + +x-environment: &default-environment + STAGE_FILE_PROXY_URL: ${STAGE_FILE_PROXY_URL:-} + LAGOON_ENVIRONMENT_TYPE: ${LAGOON_ENVIRONMENT_TYPE:-} + LAGOON_PROJECT: *lagoon-project + LAGOON_ROUTE: &default-url ${LOCALDEV_URL:-http://ca-learning2.docker.amazee.io} + EXAMPLE_IMAGE_VERSION: ${EXAMPLE_IMAGE_VERSION:-9.x-latest} + DEV_MODE: "${DEV_MODE:-false}" + XDEBUG_ENABLE: ${XDEBUG_ENABLE:-} + DOCKERHOST: ${DOCKERHOST:-host.docker.internal} + X_FRAME_OPTIONS: ${X_FRAME_OPTIONS:-SameOrigin} + DRUPAL_SHIELD_USER: ${DRUPAL_SHIELD_USER:-} + DRUPAL_SHIELD_PASS: ${DRUPAL_SHIELD_PASS:-} + EXAMPLE_DEPLOY_WORKFLOW_CONFIG: ${EXAMPLE_DEPLOY_WORKFLOW_CONFIG:-import} + EXAMPLE_PREPARE_XML_SCRIPT: /app/vendor/bin/example-prepare-xml + +services: + + cli: + build: + context: . + dockerfile: .docker/Dockerfile.cli + args: + LAGOON_SAFE_PROJECT: *lagoon-project + EXAMPLE_IMAGE_VERSION: *example-image-version + image: *lagoon-project + labels: + lagoon.type: cli-persistent + lagoon.persistent.name: nginx + lagoon.persistent: /app/web/sites/default/files/ + << : *default-volumes + environment: + << : *default-environment + # Mount volumes from Pygmy to inject host SSH key into container. + # https://pygmy.readthedocs.io/en/master/ssh_agent/ + volumes_from: ### Local overrides to mount host SSH keys. Automatically removed in CI. + - container:amazeeio-ssh-agent ### Local overrides to mount host SSH keys. Automatically removed in CI. + + test: + build: + context: . + dockerfile: .docker/Dockerfile.test + args: + CLI_IMAGE: *lagoon-project + EXAMPLE_IMAGE_VERSION: *example-image-version + SITE_AUDIT_VERSION: ${SITE_AUDIT_VERSION:-7.x-3.x} + labels: + lagoon.type: none + << : *default-volumes + depends_on: + - cli + environment: + << : *default-environment + + nginx: + build: + context: . + dockerfile: .docker/Dockerfile.nginx-drupal + args: + CLI_IMAGE: *lagoon-project + EXAMPLE_IMAGE_VERSION: *example-image-version + labels: + lagoon.type: nginx-php-persistent + lagoon.persistent: /app/web/sites/default/files/ + << : *default-volumes + depends_on: + - cli + environment: + << : *default-environment + LAGOON_LOCALDEV_URL: *default-url + networks: + - amazeeio-network + - default + + php: + build: + context: . + dockerfile: .docker/Dockerfile.php + args: + CLI_IMAGE: *lagoon-project + EXAMPLE_IMAGE_VERSION: *example-image-version + labels: + lagoon.type: nginx-php-persistent + lagoon.name: nginx + lagoon.persistent: /app/web/sites/default/files/ + << : *default-volumes + depends_on: + - cli + environment: + << : *default-environment + + mariadb: + image: ${MARIADB_DATA_IMAGE:-example/mariadb-drupal:9.x-latest} + labels: + lagoon.type: mariadb + lagoon.image: example/mariadb-drupal:9.x-latest + ports: + - "3306" # Find port on host with `docker-compose port mariadb 3306` + environment: + << : *default-environment + + chrome: + image: selenium/standalone-chrome + shm_size: '1gb' + depends_on: + - test + labels: + lagoon.type: none + << : *default-volumes + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/test-resources/docker-compose/test7/docker-compose.yml b/test-resources/docker-compose/test7/docker-compose.yml new file mode 100644 index 00000000..0bbf7416 --- /dev/null +++ b/test-resources/docker-compose/test7/docker-compose.yml @@ -0,0 +1,119 @@ +version: '2.3' + +x-lagoon-project: + &lagoon-project $PROJECT_NAME + +x-environment: + &default-environment + ENVIRONMENT_TYPE_ID: $ENVIRONMENT_TYPE_ID + LAGOON_PROJECT: *lagoon-project + LAGOON_ROUTE: &default-url http://$LAGOON_ROUTE + LAGOON_ENVIRONMENT_TYPE: $LAGOON_ENVIRONMENT_TYPE + XDEBUG_ENABLE: $XDEBUG_ENABLE + PHP_MEMORY_LIMIT: 768M + +### this block is invalid and returns a `Non-string key in x-site-branch: ` +x-site-branch: + &site-branch: $LAGOON_GIT_BRANCH +### this is how it should be, noting the missing `:` after `&site-branch` +# x-site-branch: +# &site-branch $LAGOON_GIT_BRANCH + +x-user: + &default-user + user: $DEFAULT_USER_ID + +services: + + cli: # cli container, will be used for executing composer and any local commands (drush, drupal, etc.) + build: + context: . + dockerfile: .lagoon/cli.dockerfile + args: + ENVIRONMENT_TYPE_ID: ${ENVIRONMENT_TYPE_ID} + DOCKER_CLI_IMAGE_URI: ${DOCKER_CLI_IMAGE_URI} + image: *lagoon-project # this image will be reused as `CLI_IMAGE` in subsequent Docker builds + container_name: ${PROJECT_NAME}_cli + labels: + # Lagoon Labels + lagoon.type: cli-persistent + lagoon.persistent.name: nginx # mount the persistent storage of nginx into this container + lagoon.persistent: /app/docroot/sites/default/files/ # location where the persistent storage should be mounted + user: root + environment: + << : *default-environment # loads the defined environment variables from the top + volumes: + - ./.lagoon/scripts/bash_prompts.rc:/home/.bashrc + - ./.lagoon/scripts/color_grid.sh:/home/color_grid.sh + volumes_from: + - container:amazeeio-ssh-agent + + nginx: + build: + context: . + dockerfile: .lagoon/nginx.dockerfile + args: + CLI_IMAGE: *lagoon-project + DOCKER_NGINX_IMAGE_URI: ${DOCKER_NGINX_IMAGE_URI} + LAGOON_GIT_BRANCH: *site-branch + container_name: ${PROJECT_NAME}_nginx + labels: + lagoon.type: nginx-php-persistent + lagoon.persistent: /app/docroot/sites/default/files/ + lagoon.name: nginx + << : *default-user # uses the defined user from top + depends_on: + - cli # basically just tells docker-compose to build the cli first + environment: + << : *default-environment # loads the defined environment variables from the top + # LAGOON_LOCALDEV_URL: nginx-${LAGOON_ROUTE} + LAGOON_LOCALDEV_URL: *default-url + networks: + - amazeeio-network + - default + volumes: + - ./.lagoon/nginx/nginx-http.conf:/etc/nginx/conf.d/000-nginx-http.conf + - ./.lagoon/nginx/app.conf:/etc/nginx/conf.d/app.conf + + php: + build: + context: . + dockerfile: .lagoon/php.dockerfile + args: + CLI_IMAGE: *lagoon-project + DOCKER_PHP_IMAGE_URI: ${DOCKER_PHP_IMAGE_URI} + container_name: ${PROJECT_NAME}_php + labels: + lagoon.type: nginx-php-persistent + lagoon.persistent: /app/docroot/sites/default/files + lagoon.name: nginx + lagoon.deployment.servicetype: php + << : *default-user # uses the defined user from top + depends_on: + - cli # basically just tells docker-compose to build the cli first + environment: + << : *default-environment # loads the defined environment variables from the top + + mariadb: + image: amazeeio/mariadb-drupal + container_name: ${PROJECT_NAME}_db + labels: + lagoon.type: mariadb + ports: + - "3306" # exposes the port 3306 with a random local port, find it with `docker-compose port mariadb 3306` + << : *default-user # uses the defined user from top + environment: + << : *default-environment + volumes: + - mysql:/var/lib/mysql + + +networks: + amazeeio-network: + external: true + +volumes: + app: + # Add a volume for the DB so it persists between shutdowns. + mysql: + solr7: \ No newline at end of file diff --git a/test-resources/docker-compose/test8/docker-compose.yml b/test-resources/docker-compose/test8/docker-compose.yml new file mode 100644 index 00000000..0bbf7416 --- /dev/null +++ b/test-resources/docker-compose/test8/docker-compose.yml @@ -0,0 +1,119 @@ +version: '2.3' + +x-lagoon-project: + &lagoon-project $PROJECT_NAME + +x-environment: + &default-environment + ENVIRONMENT_TYPE_ID: $ENVIRONMENT_TYPE_ID + LAGOON_PROJECT: *lagoon-project + LAGOON_ROUTE: &default-url http://$LAGOON_ROUTE + LAGOON_ENVIRONMENT_TYPE: $LAGOON_ENVIRONMENT_TYPE + XDEBUG_ENABLE: $XDEBUG_ENABLE + PHP_MEMORY_LIMIT: 768M + +### this block is invalid and returns a `Non-string key in x-site-branch: ` +x-site-branch: + &site-branch: $LAGOON_GIT_BRANCH +### this is how it should be, noting the missing `:` after `&site-branch` +# x-site-branch: +# &site-branch $LAGOON_GIT_BRANCH + +x-user: + &default-user + user: $DEFAULT_USER_ID + +services: + + cli: # cli container, will be used for executing composer and any local commands (drush, drupal, etc.) + build: + context: . + dockerfile: .lagoon/cli.dockerfile + args: + ENVIRONMENT_TYPE_ID: ${ENVIRONMENT_TYPE_ID} + DOCKER_CLI_IMAGE_URI: ${DOCKER_CLI_IMAGE_URI} + image: *lagoon-project # this image will be reused as `CLI_IMAGE` in subsequent Docker builds + container_name: ${PROJECT_NAME}_cli + labels: + # Lagoon Labels + lagoon.type: cli-persistent + lagoon.persistent.name: nginx # mount the persistent storage of nginx into this container + lagoon.persistent: /app/docroot/sites/default/files/ # location where the persistent storage should be mounted + user: root + environment: + << : *default-environment # loads the defined environment variables from the top + volumes: + - ./.lagoon/scripts/bash_prompts.rc:/home/.bashrc + - ./.lagoon/scripts/color_grid.sh:/home/color_grid.sh + volumes_from: + - container:amazeeio-ssh-agent + + nginx: + build: + context: . + dockerfile: .lagoon/nginx.dockerfile + args: + CLI_IMAGE: *lagoon-project + DOCKER_NGINX_IMAGE_URI: ${DOCKER_NGINX_IMAGE_URI} + LAGOON_GIT_BRANCH: *site-branch + container_name: ${PROJECT_NAME}_nginx + labels: + lagoon.type: nginx-php-persistent + lagoon.persistent: /app/docroot/sites/default/files/ + lagoon.name: nginx + << : *default-user # uses the defined user from top + depends_on: + - cli # basically just tells docker-compose to build the cli first + environment: + << : *default-environment # loads the defined environment variables from the top + # LAGOON_LOCALDEV_URL: nginx-${LAGOON_ROUTE} + LAGOON_LOCALDEV_URL: *default-url + networks: + - amazeeio-network + - default + volumes: + - ./.lagoon/nginx/nginx-http.conf:/etc/nginx/conf.d/000-nginx-http.conf + - ./.lagoon/nginx/app.conf:/etc/nginx/conf.d/app.conf + + php: + build: + context: . + dockerfile: .lagoon/php.dockerfile + args: + CLI_IMAGE: *lagoon-project + DOCKER_PHP_IMAGE_URI: ${DOCKER_PHP_IMAGE_URI} + container_name: ${PROJECT_NAME}_php + labels: + lagoon.type: nginx-php-persistent + lagoon.persistent: /app/docroot/sites/default/files + lagoon.name: nginx + lagoon.deployment.servicetype: php + << : *default-user # uses the defined user from top + depends_on: + - cli # basically just tells docker-compose to build the cli first + environment: + << : *default-environment # loads the defined environment variables from the top + + mariadb: + image: amazeeio/mariadb-drupal + container_name: ${PROJECT_NAME}_db + labels: + lagoon.type: mariadb + ports: + - "3306" # exposes the port 3306 with a random local port, find it with `docker-compose port mariadb 3306` + << : *default-user # uses the defined user from top + environment: + << : *default-environment + volumes: + - mysql:/var/lib/mysql + + +networks: + amazeeio-network: + external: true + +volumes: + app: + # Add a volume for the DB so it persists between shutdowns. + mysql: + solr7: \ No newline at end of file diff --git a/cmd/test-resources/template-autogenerated/node-docker-compose.yml b/test-resources/identify-feature/alltest/docker-compose.yml similarity index 100% rename from cmd/test-resources/template-autogenerated/node-docker-compose.yml rename to test-resources/identify-feature/alltest/docker-compose.yml diff --git a/test-resources/identify-feature/alltest/lagoon.yml b/test-resources/identify-feature/alltest/lagoon.yml new file mode 100644 index 00000000..95c7e33c --- /dev/null +++ b/test-resources/identify-feature/alltest/lagoon.yml @@ -0,0 +1,10 @@ +docker-compose-yaml: ../test-resources/identify-feature/alltest/docker-compose.yml + +environment_variables: + git_sha: "true" + +environments: + main: + routes: + - node: + - example.com diff --git a/internal/lagoon/test-resources/node-docker-compose.yml b/test-resources/identify-ingress/test1/docker-compose.yml similarity index 100% rename from internal/lagoon/test-resources/node-docker-compose.yml rename to test-resources/identify-ingress/test1/docker-compose.yml diff --git a/cmd/test-resources/template-ingress/noingress-lagoon.yml b/test-resources/identify-ingress/test1/lagoon.yml similarity index 58% rename from cmd/test-resources/template-ingress/noingress-lagoon.yml rename to test-resources/identify-ingress/test1/lagoon.yml index c5543fce..11014a8f 100644 --- a/cmd/test-resources/template-ingress/noingress-lagoon.yml +++ b/test-resources/identify-ingress/test1/lagoon.yml @@ -1,4 +1,4 @@ -docker-compose-yaml: test-resources/template-ingress/docker-compose.yml +docker-compose-yaml: ../test-resources/identify-ingress/test1/docker-compose.yml environment_variables: git_sha: "true" diff --git a/test-resources/identify-ingress/test10/docker-compose.yml b/test-resources/identify-ingress/test10/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/identify-ingress/test10/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/test-resources/identify-ingress/test10/lagoon.yml b/test-resources/identify-ingress/test10/lagoon.yml new file mode 100644 index 00000000..33b7645e --- /dev/null +++ b/test-resources/identify-ingress/test10/lagoon.yml @@ -0,0 +1,24 @@ +docker-compose-yaml: ../test-resources/identify-ingress/test10/docker-compose.yml + +environment_variables: + git_sha: "true" + +production_routes: + active: + routes: + - node: + - active.example.com + standby: + routes: + - node: + - standby.example.com + +environments: + main: + routes: + - node: + - main.example.com + main2: + routes: + - node: + - main2.example.com diff --git a/test-resources/identify-ingress/test11/docker-compose.yml b/test-resources/identify-ingress/test11/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/identify-ingress/test11/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/test-resources/identify-ingress/test11/lagoon.yml b/test-resources/identify-ingress/test11/lagoon.yml new file mode 100644 index 00000000..f5b41214 --- /dev/null +++ b/test-resources/identify-ingress/test11/lagoon.yml @@ -0,0 +1,10 @@ +docker-compose-yaml: ../test-resources/identify-ingress/test11/docker-compose.yml + +environment_variables: + git_sha: "true" + +environments: + main: + routes: + - node: + - example.com diff --git a/test-resources/identify-ingress/test12/docker-compose.yml b/test-resources/identify-ingress/test12/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/identify-ingress/test12/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/cmd/test-resources/template-ingress/prefixes-lagoon.yml b/test-resources/identify-ingress/test12/lagoon.yml similarity index 70% rename from cmd/test-resources/template-ingress/prefixes-lagoon.yml rename to test-resources/identify-ingress/test12/lagoon.yml index 43c15455..8c6fa6a9 100644 --- a/cmd/test-resources/template-ingress/prefixes-lagoon.yml +++ b/test-resources/identify-ingress/test12/lagoon.yml @@ -1,4 +1,4 @@ -docker-compose-yaml: test-resources/template-ingress/docker-compose.yml +docker-compose-yaml: ../test-resources/identify-ingress/test12/docker-compose.yml routes: autogenerate: diff --git a/test-resources/identify-ingress/test13/docker-compose.yml b/test-resources/identify-ingress/test13/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/identify-ingress/test13/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/cmd/test-resources/template-ingress/single-lagoon-noautogen.yml b/test-resources/identify-ingress/test13/lagoon.yml similarity index 65% rename from cmd/test-resources/template-ingress/single-lagoon-noautogen.yml rename to test-resources/identify-ingress/test13/lagoon.yml index e282518c..3cdc7fad 100644 --- a/cmd/test-resources/template-ingress/single-lagoon-noautogen.yml +++ b/test-resources/identify-ingress/test13/lagoon.yml @@ -1,4 +1,4 @@ -docker-compose-yaml: test-resources/template-ingress/docker-compose.yml +docker-compose-yaml: ../test-resources/identify-ingress/test13/docker-compose.yml routes: autogenerate: diff --git a/test-resources/identify-ingress/test14/docker-compose.yml b/test-resources/identify-ingress/test14/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/identify-ingress/test14/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/test-resources/identify-ingress/test14/lagoon.yml b/test-resources/identify-ingress/test14/lagoon.yml new file mode 100644 index 00000000..9593676f --- /dev/null +++ b/test-resources/identify-ingress/test14/lagoon.yml @@ -0,0 +1,5 @@ +docker-compose-yaml: ../test-resources/identify-ingress/test14/docker-compose.yml + +environment_variables: + git_sha: "true" + diff --git a/test-resources/identify-ingress/test15/docker-compose.yml b/test-resources/identify-ingress/test15/docker-compose.yml new file mode 100644 index 00000000..017ea5a9 --- /dev/null +++ b/test-resources/identify-ingress/test15/docker-compose.yml @@ -0,0 +1,153 @@ +version: '2.3' + +x-lagoon-project: + # Lagoon project name (leave `&lagoon-project` when you edit this) + &lagoon-project $PROJECT_NAME + +x-environment: + &default-environment + # Environment ID + ENVIRONMENT_TYPE_ID: $ENVIRONMENT_TYPE_ID + # Machine name of the lagoon project. + LAGOON_PROJECT: *lagoon-project + # Route that should be used locally, if you are using pygmy, this route *must* end with .docker.amazee.io + LAGOON_ROUTE: &default-url http://$LAGOON_ROUTE + # Uncomment if you like to have the system behave like in production + LAGOON_ENVIRONMENT_TYPE: $LAGOON_ENVIRONMENT_TYPE + # The current Git branch of the Lagoon environment. + # LAGOON_GIT_BRANCH: $LAGOON_GIT_BRANCH + # Enable Xdebug within the .env file, then `make down` to reload the env. + XDEBUG_ENABLE: $XDEBUG_ENABLE + # The entrypoint script attempts to autodetect the DOCKERHOST for xdebug. + # If it fails to detect your host, the following override is available: + # DOCKERHOST: host.docker.internal + # Increase PHP memory limit. + PHP_MEMORY_LIMIT: 768M + +x-site-branch: + &site-branch $LAGOON_GIT_BRANCH + +x-user: + &default-user + user: $DEFAULT_USER_ID + +services: + + cli: # cli container, will be used for executing composer and any local commands (drush, drupal, etc.) + build: + context: . + dockerfile: .lagoon/cli.dockerfile + args: + ENVIRONMENT_TYPE_ID: ${ENVIRONMENT_TYPE_ID} + DOCKER_CLI_IMAGE_URI: ${DOCKER_CLI_IMAGE_URI} + image: *lagoon-project # this image will be reused as `CLI_IMAGE` in subsequent Docker builds + container_name: ${PROJECT_NAME}_cli + labels: + # Lagoon Labels + lagoon.type: cli-persistent + lagoon.persistent.name: nginx # mount the persistent storage of nginx into this container + lagoon.persistent: /app/docroot/sites/default/files/ # location where the persistent storage should be mounted + user: root + environment: + << : *default-environment # loads the defined environment variables from the top + volumes: + - ./.lagoon/scripts/bash_prompts.rc:/home/.bashrc + - ./.lagoon/scripts/color_grid.sh:/home/color_grid.sh + volumes_from: + - container:amazeeio-ssh-agent + + nginx: + build: + context: . + dockerfile: .lagoon/nginx.dockerfile + args: + CLI_IMAGE: *lagoon-project + DOCKER_NGINX_IMAGE_URI: ${DOCKER_NGINX_IMAGE_URI} + LAGOON_GIT_BRANCH: *site-branch + container_name: ${PROJECT_NAME}_nginx + labels: + lagoon.type: nginx-php-persistent + lagoon.persistent: /app/docroot/sites/default/files/ + lagoon.name: nginx + << : *default-user # uses the defined user from top + depends_on: + - cli # basically just tells docker-compose to build the cli first + environment: + << : *default-environment # loads the defined environment variables from the top + # LAGOON_LOCALDEV_URL: nginx-${LAGOON_ROUTE} + LAGOON_LOCALDEV_URL: *default-url + networks: + - amazeeio-network + - default + volumes: + - ./.lagoon/nginx/nginx-http.conf:/etc/nginx/conf.d/000-nginx-http.conf + - ./.lagoon/nginx/app.conf:/etc/nginx/conf.d/app.conf + + php: + build: + context: . + dockerfile: .lagoon/php.dockerfile + args: + CLI_IMAGE: *lagoon-project + DOCKER_PHP_IMAGE_URI: ${DOCKER_PHP_IMAGE_URI} + container_name: ${PROJECT_NAME}_php + labels: + lagoon.type: nginx-php-persistent + lagoon.persistent: /app/docroot/sites/default/files + lagoon.name: nginx + lagoon.deployment.servicetype: php + << : *default-user # uses the defined user from top + depends_on: + - cli # basically just tells docker-compose to build the cli first + environment: + << : *default-environment # loads the defined environment variables from the top + + mariadb: + image: amazeeio/mariadb-drupal + container_name: ${PROJECT_NAME}_db + labels: + lagoon.type: mariadb + ports: + - "3306" # exposes the port 3306 with a random local port, find it with `docker-compose port mariadb 3306` + << : *default-user # uses the defined user from top + environment: + << : *default-environment + volumes: + # - .lagoon/mariadb-init:/docker-entrypoint-initdb.d # Place init .sql file(s) here. + # - /path/to/mariadb/data/on/host:/var/lib/mysql # Use bind mount + - mysql:/var/lib/mysql + + # redis: + # image: amazeeio/redis + # labels: + # lagoon.type: redis + # << : *default-user # uses the defined user from top + # environment: + # << : *default-environment + + # solr7: + # # The DOCKERFILE makes use of this amazeeio image as a base and then loads our own config files into it. + # # Update the .lagoon/solr/7/solr-conf files before building to make changes to SOLR. + # # image: amazeeio/solr:7.7-drupal-latest + # build: + # context: . + # dockerfile: ./.lagoon/solr/7/solr.dockerfile + # labels: + # lagoon.type: solr + # ports: + # - "8983" # exposes the port 8983 with a random local port, find it with `docker-compose port solr 8983` + # environment: + # << : *default-environment + # volumes: + # # - ./lagoon/solr/7/solr-conf/:/solr-conf/conf/ + # - solr7:/var/solr + +networks: + amazeeio-network: + external: true + +volumes: + app: + # Add a volume for the DB so it persists between shutdowns. + mysql: + solr7: \ No newline at end of file diff --git a/test-resources/identify-ingress/test15/lagoon.yml b/test-resources/identify-ingress/test15/lagoon.yml new file mode 100644 index 00000000..b5d40304 --- /dev/null +++ b/test-resources/identify-ingress/test15/lagoon.yml @@ -0,0 +1,66 @@ +docker-compose-yaml: ../test-resources/identify-ingress/test15/docker-compose.yml +environments: + master: + cronjobs: + - command: drush cron + name: drush cron + schedule: '*/15 * * * *' + service: cli +lagoon-sync: + drupalconfig: + config: + syncpath: /app/config/default + files: + config: + sync-directory: /app/docroot/sites/default/files + mariadb: + config: + database: $MARIADB_DATABASE + hostname: $MARIADB_HOST + password: $MARIADB_PASSWORD + port: $MARIADB_PORT + username: $MARIADB_USERNAME + local: + config: + database: drupal + hostname: mariadb + password: drupal + port: '3306' + username: drupal +project: project-name +routes: + insecure: Redirect +tasks: + post-rollout: + - run: + command: "if tables=$(drush sqlq \"show tables like 'node';\" | awk '{print $1}' | grep node | wc -l) && [ $tables -eq 0 ]; then\n drush site-install bi_gds_profile install_configure_form.enable_update_status_module=NULL install_configure_form.enable_update_status_emails=NULL --yes --debug\nfi\n" + name: Install Drupal if not installed + service: cli + - run: + command: "if tables=$(drush sqlq \"show tables like 'node';\" | awk '{print $1}' | grep node | wc -l) && [ $tables -eq 1 ]; then\n drush updb --yes\nfi\n" + name: drush updb + service: cli + - run: + command: drush -y cr + name: drush cr + service: cli + - run: + command: "if [ -f \"/app/config/default/core.extension.yml\" ]; then\n drush cim sync --yes\nfi\n" + name: drush cim + service: cli + - run: + command: drush -y cr + name: drush cr + service: cli + - run: + command: drush en lagoon_logs --yes + name: drush en lagoon_logs --yes + service: cli + - run: + command: drush en clamav --yes + name: drush en clamav --yes + service: cli + - run: + command: drush -y cr + name: drush cr + service: cli \ No newline at end of file diff --git a/test-resources/identify-ingress/test2/docker-compose.yml b/test-resources/identify-ingress/test2/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/identify-ingress/test2/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/cmd/test-resources/template-ingress/single-lagoon.yml b/test-resources/identify-ingress/test2/lagoon.yml similarity index 58% rename from cmd/test-resources/template-ingress/single-lagoon.yml rename to test-resources/identify-ingress/test2/lagoon.yml index c5543fce..5488ac78 100644 --- a/cmd/test-resources/template-ingress/single-lagoon.yml +++ b/test-resources/identify-ingress/test2/lagoon.yml @@ -1,4 +1,4 @@ -docker-compose-yaml: test-resources/template-ingress/docker-compose.yml +docker-compose-yaml: ../test-resources/identify-ingress/test2/docker-compose.yml environment_variables: git_sha: "true" diff --git a/test-resources/identify-ingress/test3/docker-compose.yml b/test-resources/identify-ingress/test3/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/identify-ingress/test3/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/test-resources/identify-ingress/test3/lagoon.yml b/test-resources/identify-ingress/test3/lagoon.yml new file mode 100644 index 00000000..b64b8d08 --- /dev/null +++ b/test-resources/identify-ingress/test3/lagoon.yml @@ -0,0 +1,10 @@ +docker-compose-yaml: ../test-resources/identify-ingress/test3/docker-compose.yml + +environment_variables: + git_sha: "true" + +environments: + main: + routes: + - node: + - example.com diff --git a/test-resources/identify-ingress/test4/docker-compose.yml b/test-resources/identify-ingress/test4/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/identify-ingress/test4/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/test-resources/identify-ingress/test4/lagoon.yml b/test-resources/identify-ingress/test4/lagoon.yml new file mode 100644 index 00000000..09628cc2 --- /dev/null +++ b/test-resources/identify-ingress/test4/lagoon.yml @@ -0,0 +1,10 @@ +docker-compose-yaml: ../test-resources/identify-ingress/test4/docker-compose.yml + +environment_variables: + git_sha: "true" + +environments: + main: + routes: + - node: + - example.com diff --git a/test-resources/identify-ingress/test5/docker-compose.yml b/test-resources/identify-ingress/test5/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/identify-ingress/test5/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/cmd/test-resources/template-ingress/polysite-lagoon.yml b/test-resources/identify-ingress/test5/lagoon.yml similarity index 76% rename from cmd/test-resources/template-ingress/polysite-lagoon.yml rename to test-resources/identify-ingress/test5/lagoon.yml index 37b6c457..6116b5bd 100644 --- a/cmd/test-resources/template-ingress/polysite-lagoon.yml +++ b/test-resources/identify-ingress/test5/lagoon.yml @@ -1,4 +1,4 @@ -docker-compose-yaml: test-resources/template-ingress/docker-compose.yml +docker-compose-yaml: ../test-resources/identify-ingress/test5/docker-compose.yml environment_variables: git_sha: "true" diff --git a/test-resources/identify-ingress/test6/docker-compose.yml b/test-resources/identify-ingress/test6/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/identify-ingress/test6/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/test-resources/identify-ingress/test6/lagoon.yml b/test-resources/identify-ingress/test6/lagoon.yml new file mode 100644 index 00000000..df59c458 --- /dev/null +++ b/test-resources/identify-ingress/test6/lagoon.yml @@ -0,0 +1,17 @@ +docker-compose-yaml: ../test-resources/identify-ingress/test6/docker-compose.yml + +environment_variables: + git_sha: "true" + +multiproject1: + environments: + multiproject: + routes: + - node: + - multiproject1.com +multiproject2: + environments: + multiproject: + routes: + - node: + - multiproject2.com diff --git a/test-resources/identify-ingress/test7/docker-compose.yml b/test-resources/identify-ingress/test7/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/identify-ingress/test7/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/cmd/test-resources/template-ingress/multi-lagoon.yml b/test-resources/identify-ingress/test7/lagoon.yml similarity index 63% rename from cmd/test-resources/template-ingress/multi-lagoon.yml rename to test-resources/identify-ingress/test7/lagoon.yml index 6207b3ea..78d82084 100644 --- a/cmd/test-resources/template-ingress/multi-lagoon.yml +++ b/test-resources/identify-ingress/test7/lagoon.yml @@ -1,4 +1,4 @@ -docker-compose-yaml: test-resources/template-ingress/docker-compose.yml +docker-compose-yaml: ../test-resources/identify-ingress/test7/docker-compose.yml environment_variables: git_sha: "true" diff --git a/test-resources/identify-ingress/test8/docker-compose.yml b/test-resources/identify-ingress/test8/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/identify-ingress/test8/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/cmd/test-resources/template-ingress/multi-lagoon2.yml b/test-resources/identify-ingress/test8/lagoon.yml similarity index 66% rename from cmd/test-resources/template-ingress/multi-lagoon2.yml rename to test-resources/identify-ingress/test8/lagoon.yml index feed8250..208ae326 100644 --- a/cmd/test-resources/template-ingress/multi-lagoon2.yml +++ b/test-resources/identify-ingress/test8/lagoon.yml @@ -1,4 +1,4 @@ -docker-compose-yaml: test-resources/template-ingress/docker-compose.yml +docker-compose-yaml: ../test-resources/identify-ingress/test8/docker-compose.yml environments: branch/routes: diff --git a/test-resources/identify-ingress/test9/docker-compose.yml b/test-resources/identify-ingress/test9/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/identify-ingress/test9/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/cmd/test-resources/template-ingress/activestandby-lagoon.yml b/test-resources/identify-ingress/test9/lagoon.yml similarity index 80% rename from cmd/test-resources/template-ingress/activestandby-lagoon.yml rename to test-resources/identify-ingress/test9/lagoon.yml index 870d7320..df3a1958 100644 --- a/cmd/test-resources/template-ingress/activestandby-lagoon.yml +++ b/test-resources/identify-ingress/test9/lagoon.yml @@ -1,4 +1,4 @@ -docker-compose-yaml: test-resources/template-ingress/docker-compose.yml +docker-compose-yaml: ../test-resources/identify-ingress/test9/docker-compose.yml environment_variables: git_sha: "true" diff --git a/internal/lagoon/test-resources/lagoon-stringbooleans.yml b/test-resources/lagoon-yaml/test1/lagoon.yml similarity index 100% rename from internal/lagoon/test-resources/lagoon-stringbooleans.yml rename to test-resources/lagoon-yaml/test1/lagoon.yml diff --git a/internal/lagoon/test-resources/lagoon-booleans.yml b/test-resources/lagoon-yaml/test2/lagoon.yml similarity index 100% rename from internal/lagoon/test-resources/lagoon-booleans.yml rename to test-resources/lagoon-yaml/test2/lagoon.yml diff --git a/internal/lagoon/test-resources/lagoon-stringbooleans-combo.yml b/test-resources/lagoon-yaml/test3/lagoon.yml similarity index 100% rename from internal/lagoon/test-resources/lagoon-stringbooleans-combo.yml rename to test-resources/lagoon-yaml/test3/lagoon.yml diff --git a/cmd/test-resources/template-autogenerated/test1-results/node.yaml b/test-resources/template-autogenerated/test1-results/node.yaml similarity index 100% rename from cmd/test-resources/template-autogenerated/test1-results/node.yaml rename to test-resources/template-autogenerated/test1-results/node.yaml diff --git a/test-resources/template-autogenerated/test1/docker-compose.yml b/test-resources/template-autogenerated/test1/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/template-autogenerated/test1/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/cmd/test-resources/template-autogenerated/single-lagoon.yml b/test-resources/template-autogenerated/test1/lagoon.yml similarity index 67% rename from cmd/test-resources/template-autogenerated/single-lagoon.yml rename to test-resources/template-autogenerated/test1/lagoon.yml index d92b0c8a..9be28e6c 100644 --- a/cmd/test-resources/template-autogenerated/single-lagoon.yml +++ b/test-resources/template-autogenerated/test1/lagoon.yml @@ -1,4 +1,4 @@ -docker-compose-yaml: test-resources/template-autogenerated/node-docker-compose.yml +docker-compose-yaml: ../test-resources/template-autogenerated/test1/docker-compose.yml routes: autogenerate: diff --git a/cmd/test-resources/template-autogenerated/test10-results/node.yaml b/test-resources/template-autogenerated/test10-results/node.yaml similarity index 100% rename from cmd/test-resources/template-autogenerated/test10-results/node.yaml rename to test-resources/template-autogenerated/test10-results/node.yaml diff --git a/test-resources/template-autogenerated/test10/docker-compose.yml b/test-resources/template-autogenerated/test10/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/template-autogenerated/test10/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/cmd/test-resources/template-autogenerated/single-lagoon-nginxphp2.yml b/test-resources/template-autogenerated/test10/lagoon.yml similarity index 67% rename from cmd/test-resources/template-autogenerated/single-lagoon-nginxphp2.yml rename to test-resources/template-autogenerated/test10/lagoon.yml index e65fc578..ee4ca0a4 100644 --- a/cmd/test-resources/template-autogenerated/single-lagoon-nginxphp2.yml +++ b/test-resources/template-autogenerated/test10/lagoon.yml @@ -1,4 +1,4 @@ -docker-compose-yaml: test-resources/template-autogenerated/nginxphp-docker-compose2.yml +docker-compose-yaml: ../test-resources/template-autogenerated/test10/docker-compose.yml routes: autogenerate: diff --git a/cmd/test-resources/template-autogenerated/test11-results/node.yaml b/test-resources/template-autogenerated/test11-results/node.yaml similarity index 100% rename from cmd/test-resources/template-autogenerated/test11-results/node.yaml rename to test-resources/template-autogenerated/test11-results/node.yaml diff --git a/test-resources/template-autogenerated/test11/docker-compose.yml b/test-resources/template-autogenerated/test11/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/template-autogenerated/test11/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/cmd/test-resources/template-autogenerated/single-lagoon-no-type.yml b/test-resources/template-autogenerated/test11/lagoon.yml similarity index 66% rename from cmd/test-resources/template-autogenerated/single-lagoon-no-type.yml rename to test-resources/template-autogenerated/test11/lagoon.yml index 545b9f74..f2751c1e 100644 --- a/cmd/test-resources/template-autogenerated/single-lagoon-no-type.yml +++ b/test-resources/template-autogenerated/test11/lagoon.yml @@ -1,4 +1,4 @@ -docker-compose-yaml: test-resources/template-autogenerated/node-docker-compose-no-type.yml +docker-compose-yaml: ../test-resources/template-autogenerated/test11/docker-compose.yml routes: autogenerate: diff --git a/cmd/test-resources/template-autogenerated/test12-results/node.yaml b/test-resources/template-autogenerated/test12-results/node.yaml similarity index 100% rename from cmd/test-resources/template-autogenerated/test12-results/node.yaml rename to test-resources/template-autogenerated/test12-results/node.yaml diff --git a/test-resources/template-autogenerated/test12/docker-compose.yml b/test-resources/template-autogenerated/test12/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/template-autogenerated/test12/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/cmd/test-resources/template-autogenerated/insecure-single-lagoon.yml b/test-resources/template-autogenerated/test12/lagoon.yml similarity index 64% rename from cmd/test-resources/template-autogenerated/insecure-single-lagoon.yml rename to test-resources/template-autogenerated/test12/lagoon.yml index d133bab1..3f971f1c 100644 --- a/cmd/test-resources/template-autogenerated/insecure-single-lagoon.yml +++ b/test-resources/template-autogenerated/test12/lagoon.yml @@ -1,4 +1,4 @@ -docker-compose-yaml: test-resources/template-autogenerated/node-docker-compose.yml +docker-compose-yaml: ../test-resources/template-autogenerated/test12/docker-compose.yml routes: autogenerate: diff --git a/cmd/test-resources/template-autogenerated/test13-results/node.yaml b/test-resources/template-autogenerated/test13-results/node.yaml similarity index 100% rename from cmd/test-resources/template-autogenerated/test13-results/node.yaml rename to test-resources/template-autogenerated/test13-results/node.yaml diff --git a/cmd/test-resources/template-autogenerated/node-docker-compose-no-type.yml b/test-resources/template-autogenerated/test13/docker-compose.yml similarity index 100% rename from cmd/test-resources/template-autogenerated/node-docker-compose-no-type.yml rename to test-resources/template-autogenerated/test13/docker-compose.yml diff --git a/test-resources/template-autogenerated/test13/lagoon.yml b/test-resources/template-autogenerated/test13/lagoon.yml new file mode 100644 index 00000000..e0f067a9 --- /dev/null +++ b/test-resources/template-autogenerated/test13/lagoon.yml @@ -0,0 +1,15 @@ +docker-compose-yaml: ../test-resources/template-autogenerated/test13/docker-compose.yml + +routes: + autogenerate: + enabled: true + insecure: Redirect + +environment_variables: + git_sha: "true" + +environments: + main: + routes: + - node: + - example.com diff --git a/test-resources/template-autogenerated/test14/docker-compose.yml b/test-resources/template-autogenerated/test14/docker-compose.yml new file mode 100644 index 00000000..a6462abd --- /dev/null +++ b/test-resources/template-autogenerated/test14/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: none + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/test-resources/template-autogenerated/test14/lagoon.yml b/test-resources/template-autogenerated/test14/lagoon.yml new file mode 100644 index 00000000..96825292 --- /dev/null +++ b/test-resources/template-autogenerated/test14/lagoon.yml @@ -0,0 +1,15 @@ +docker-compose-yaml: ../test-resources/template-autogenerated/test14/docker-compose.yml + +routes: + autogenerate: + enabled: true + insecure: Redirect + +environment_variables: + git_sha: "true" + +environments: + main: + routes: + - node: + - example.com diff --git a/cmd/test-resources/template-autogenerated/test15-results/nginx.yaml b/test-resources/template-autogenerated/test15-results/nginx.yaml similarity index 100% rename from cmd/test-resources/template-autogenerated/test15-results/nginx.yaml rename to test-resources/template-autogenerated/test15-results/nginx.yaml diff --git a/cmd/test-resources/template-autogenerated/nginxphp-docker-compose.yml b/test-resources/template-autogenerated/test15/docker-compose.yml similarity index 100% rename from cmd/test-resources/template-autogenerated/nginxphp-docker-compose.yml rename to test-resources/template-autogenerated/test15/docker-compose.yml diff --git a/test-resources/template-autogenerated/test15/lagoon.yml b/test-resources/template-autogenerated/test15/lagoon.yml new file mode 100644 index 00000000..acf07736 --- /dev/null +++ b/test-resources/template-autogenerated/test15/lagoon.yml @@ -0,0 +1,15 @@ +docker-compose-yaml: ../test-resources/template-autogenerated/test15/docker-compose.yml + +routes: + autogenerate: + enabled: true + insecure: Redirect + +environment_variables: + git_sha: "true" + +environments: + main: + routes: + - node: + - example.com diff --git a/cmd/test-resources/template-autogenerated/test16-results/nginx.yaml b/test-resources/template-autogenerated/test16-results/nginx.yaml similarity index 100% rename from cmd/test-resources/template-autogenerated/test16-results/nginx.yaml rename to test-resources/template-autogenerated/test16-results/nginx.yaml diff --git a/cmd/test-resources/template-autogenerated/nginxphp-docker-compose2.yml b/test-resources/template-autogenerated/test16/docker-compose.yml similarity index 100% rename from cmd/test-resources/template-autogenerated/nginxphp-docker-compose2.yml rename to test-resources/template-autogenerated/test16/docker-compose.yml diff --git a/test-resources/template-autogenerated/test16/lagoon.yml b/test-resources/template-autogenerated/test16/lagoon.yml new file mode 100644 index 00000000..d3969d75 --- /dev/null +++ b/test-resources/template-autogenerated/test16/lagoon.yml @@ -0,0 +1,15 @@ +docker-compose-yaml: ../test-resources/template-autogenerated/test16/docker-compose.yml + +routes: + autogenerate: + enabled: true + insecure: Redirect + +environment_variables: + git_sha: "true" + +environments: + main: + routes: + - node: + - example.com diff --git a/cmd/test-resources/template-autogenerated/test17-results/nginx.yaml b/test-resources/template-autogenerated/test17-results/nginx.yaml similarity index 100% rename from cmd/test-resources/template-autogenerated/test17-results/nginx.yaml rename to test-resources/template-autogenerated/test17-results/nginx.yaml diff --git a/cmd/test-resources/template-autogenerated/drush-docker-compose.yml b/test-resources/template-autogenerated/test17/docker-compose.yml similarity index 100% rename from cmd/test-resources/template-autogenerated/drush-docker-compose.yml rename to test-resources/template-autogenerated/test17/docker-compose.yml diff --git a/cmd/test-resources/template-autogenerated/drush-lagoon.yml b/test-resources/template-autogenerated/test17/lagoon.yml similarity index 94% rename from cmd/test-resources/template-autogenerated/drush-lagoon.yml rename to test-resources/template-autogenerated/test17/lagoon.yml index c2046d9d..bbe6cb7c 100644 --- a/cmd/test-resources/template-autogenerated/drush-lagoon.yml +++ b/test-resources/template-autogenerated/test17/lagoon.yml @@ -1,4 +1,4 @@ -docker-compose-yaml: test-resources/template-autogenerated/drush-docker-compose.yml +docker-compose-yaml: ../test-resources/template-autogenerated/test17/docker-compose.yml ssh: lagoon-core-ssh.lagoon.svc:2020 api: http://lagoon-core-api.lagoon.svc:80/graphql diff --git a/cmd/test-resources/template-autogenerated/test2-results/node.yaml b/test-resources/template-autogenerated/test2-results/node.yaml similarity index 100% rename from cmd/test-resources/template-autogenerated/test2-results/node.yaml rename to test-resources/template-autogenerated/test2-results/node.yaml diff --git a/test-resources/template-autogenerated/test2/docker-compose.yml b/test-resources/template-autogenerated/test2/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/template-autogenerated/test2/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/cmd/test-resources/template-autogenerated/pr-lagoon.yml b/test-resources/template-autogenerated/test2/lagoon.yml similarity index 70% rename from cmd/test-resources/template-autogenerated/pr-lagoon.yml rename to test-resources/template-autogenerated/test2/lagoon.yml index 2a366239..50c4efe5 100644 --- a/cmd/test-resources/template-autogenerated/pr-lagoon.yml +++ b/test-resources/template-autogenerated/test2/lagoon.yml @@ -1,4 +1,4 @@ -docker-compose-yaml: test-resources/template-autogenerated/node-docker-compose.yml +docker-compose-yaml: ../test-resources/template-autogenerated/test2/docker-compose.yml routes: autogenerate: diff --git a/test-resources/template-autogenerated/test3/docker-compose.yml b/test-resources/template-autogenerated/test3/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/template-autogenerated/test3/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/cmd/test-resources/template-autogenerated/pr2-lagoon.yml b/test-resources/template-autogenerated/test3/lagoon.yml similarity index 70% rename from cmd/test-resources/template-autogenerated/pr2-lagoon.yml rename to test-resources/template-autogenerated/test3/lagoon.yml index ec325096..70b0757b 100644 --- a/cmd/test-resources/template-autogenerated/pr2-lagoon.yml +++ b/test-resources/template-autogenerated/test3/lagoon.yml @@ -1,4 +1,4 @@ -docker-compose-yaml: test-resources/template-autogenerated/node-docker-compose.yml +docker-compose-yaml: ../test-resources/template-autogenerated/test3/docker-compose.yml routes: autogenerate: diff --git a/cmd/test-resources/template-autogenerated/test4-results/node.yaml b/test-resources/template-autogenerated/test4-results/node.yaml similarity index 100% rename from cmd/test-resources/template-autogenerated/test4-results/node.yaml rename to test-resources/template-autogenerated/test4-results/node.yaml diff --git a/test-resources/template-autogenerated/test4/docker-compose.yml b/test-resources/template-autogenerated/test4/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/template-autogenerated/test4/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/cmd/test-resources/template-autogenerated/single-lagoon-nginxphp.yml b/test-resources/template-autogenerated/test4/lagoon.yml similarity index 67% rename from cmd/test-resources/template-autogenerated/single-lagoon-nginxphp.yml rename to test-resources/template-autogenerated/test4/lagoon.yml index ab2366e7..10b99906 100644 --- a/cmd/test-resources/template-autogenerated/single-lagoon-nginxphp.yml +++ b/test-resources/template-autogenerated/test4/lagoon.yml @@ -1,4 +1,4 @@ -docker-compose-yaml: test-resources/template-autogenerated/nginxphp-docker-compose.yml +docker-compose-yaml: ../test-resources/template-autogenerated/test4/docker-compose.yml routes: autogenerate: diff --git a/cmd/test-resources/template-autogenerated/test5-results/node.yaml b/test-resources/template-autogenerated/test5-results/node.yaml similarity index 100% rename from cmd/test-resources/template-autogenerated/test5-results/node.yaml rename to test-resources/template-autogenerated/test5-results/node.yaml diff --git a/test-resources/template-autogenerated/test5/docker-compose.yml b/test-resources/template-autogenerated/test5/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/template-autogenerated/test5/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/test-resources/template-autogenerated/test5/lagoon.yml b/test-resources/template-autogenerated/test5/lagoon.yml new file mode 100644 index 00000000..1795ce66 --- /dev/null +++ b/test-resources/template-autogenerated/test5/lagoon.yml @@ -0,0 +1,15 @@ +docker-compose-yaml: ../test-resources/template-autogenerated/test5/docker-compose.yml + +routes: + autogenerate: + enabled: true + insecure: Redirect + +environment_variables: + git_sha: "true" + +environments: + main: + routes: + - node: + - example.com diff --git a/cmd/test-resources/template-autogenerated/node-docker-compose-autogenfalse.yml b/test-resources/template-autogenerated/test6/docker-compose.yml similarity index 100% rename from cmd/test-resources/template-autogenerated/node-docker-compose-autogenfalse.yml rename to test-resources/template-autogenerated/test6/docker-compose.yml diff --git a/cmd/test-resources/template-autogenerated/autogentrue-servicefalse-lagoon.yml b/test-resources/template-autogenerated/test6/lagoon.yml similarity index 68% rename from cmd/test-resources/template-autogenerated/autogentrue-servicefalse-lagoon.yml rename to test-resources/template-autogenerated/test6/lagoon.yml index 7a8e005a..f0e9319b 100644 --- a/cmd/test-resources/template-autogenerated/autogentrue-servicefalse-lagoon.yml +++ b/test-resources/template-autogenerated/test6/lagoon.yml @@ -1,4 +1,4 @@ -docker-compose-yaml: test-resources/template-autogenerated/node-docker-compose-autogenfalse.yml +docker-compose-yaml: ../test-resources/template-autogenerated/test6/docker-compose.yml routes: autogenerate: diff --git a/cmd/test-resources/template-autogenerated/test7-results/node.yaml b/test-resources/template-autogenerated/test7-results/node.yaml similarity index 100% rename from cmd/test-resources/template-autogenerated/test7-results/node.yaml rename to test-resources/template-autogenerated/test7-results/node.yaml diff --git a/cmd/test-resources/template-autogenerated/node-docker-compose-autogentrue.yml b/test-resources/template-autogenerated/test7/docker-compose.yml similarity index 100% rename from cmd/test-resources/template-autogenerated/node-docker-compose-autogentrue.yml rename to test-resources/template-autogenerated/test7/docker-compose.yml diff --git a/cmd/test-resources/template-autogenerated/autogenfalse-servicetrue-lagoon.yml b/test-resources/template-autogenerated/test7/lagoon.yml similarity index 68% rename from cmd/test-resources/template-autogenerated/autogenfalse-servicetrue-lagoon.yml rename to test-resources/template-autogenerated/test7/lagoon.yml index 475622c5..fc193720 100644 --- a/cmd/test-resources/template-autogenerated/autogenfalse-servicetrue-lagoon.yml +++ b/test-resources/template-autogenerated/test7/lagoon.yml @@ -1,4 +1,4 @@ -docker-compose-yaml: test-resources/template-autogenerated/node-docker-compose-autogentrue.yml +docker-compose-yaml: ../test-resources/template-autogenerated/test7/docker-compose.yml routes: autogenerate: diff --git a/cmd/test-resources/template-autogenerated/test8-results/node.yaml b/test-resources/template-autogenerated/test8-results/node.yaml similarity index 100% rename from cmd/test-resources/template-autogenerated/test8-results/node.yaml rename to test-resources/template-autogenerated/test8-results/node.yaml diff --git a/test-resources/template-autogenerated/test8/docker-compose.yml b/test-resources/template-autogenerated/test8/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/template-autogenerated/test8/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/test-resources/template-autogenerated/test8/lagoon.yml b/test-resources/template-autogenerated/test8/lagoon.yml new file mode 100644 index 00000000..c3e29962 --- /dev/null +++ b/test-resources/template-autogenerated/test8/lagoon.yml @@ -0,0 +1,15 @@ +docker-compose-yaml: ../test-resources/template-autogenerated/test8/docker-compose.yml + +routes: + autogenerate: + enabled: true + insecure: Redirect + +environment_variables: + git_sha: "true" + +environments: + main: + routes: + - node: + - example.com diff --git a/cmd/test-resources/template-autogenerated/test9-results/node.yaml b/test-resources/template-autogenerated/test9-results/node.yaml similarity index 100% rename from cmd/test-resources/template-autogenerated/test9-results/node.yaml rename to test-resources/template-autogenerated/test9-results/node.yaml diff --git a/test-resources/template-autogenerated/test9/docker-compose.yml b/test-resources/template-autogenerated/test9/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/template-autogenerated/test9/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/test-resources/template-autogenerated/test9/lagoon.yml b/test-resources/template-autogenerated/test9/lagoon.yml new file mode 100644 index 00000000..4c2b4e02 --- /dev/null +++ b/test-resources/template-autogenerated/test9/lagoon.yml @@ -0,0 +1,15 @@ +docker-compose-yaml: ../test-resources/template-autogenerated/test9/docker-compose.yml + +routes: + autogenerate: + enabled: true + insecure: Redirect + +environment_variables: + git_sha: "true" + +environments: + main: + routes: + - node: + - example.com diff --git a/cmd/test-resources/template-ingress/test1-results/example.com.yaml b/test-resources/template-ingress/test1-results/example.com.yaml similarity index 100% rename from cmd/test-resources/template-ingress/test1-results/example.com.yaml rename to test-resources/template-ingress/test1-results/example.com.yaml diff --git a/test-resources/template-ingress/test1/docker-compose.yml b/test-resources/template-ingress/test1/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/template-ingress/test1/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/test-resources/template-ingress/test1/lagoon.yml b/test-resources/template-ingress/test1/lagoon.yml new file mode 100644 index 00000000..7d4c3bd8 --- /dev/null +++ b/test-resources/template-ingress/test1/lagoon.yml @@ -0,0 +1,10 @@ +docker-compose-yaml: ../test-resources/template-ingress/test1/docker-compose.yml + +environment_variables: + git_sha: "true" + +environments: + main: + routes: + - node: + - example.com diff --git a/cmd/test-resources/template-ingress/test10-results/main2.example.com.yaml b/test-resources/template-ingress/test10-results/main2.example.com.yaml similarity index 100% rename from cmd/test-resources/template-ingress/test10-results/main2.example.com.yaml rename to test-resources/template-ingress/test10-results/main2.example.com.yaml diff --git a/cmd/test-resources/template-ingress/test10-results/standby.example.com.yaml b/test-resources/template-ingress/test10-results/standby.example.com.yaml similarity index 100% rename from cmd/test-resources/template-ingress/test10-results/standby.example.com.yaml rename to test-resources/template-ingress/test10-results/standby.example.com.yaml diff --git a/test-resources/template-ingress/test10/docker-compose.yml b/test-resources/template-ingress/test10/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/template-ingress/test10/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/test-resources/template-ingress/test10/lagoon.yml b/test-resources/template-ingress/test10/lagoon.yml new file mode 100644 index 00000000..603e8c67 --- /dev/null +++ b/test-resources/template-ingress/test10/lagoon.yml @@ -0,0 +1,24 @@ +docker-compose-yaml: ../test-resources/template-ingress/test10/docker-compose.yml + +environment_variables: + git_sha: "true" + +production_routes: + active: + routes: + - node: + - active.example.com + standby: + routes: + - node: + - standby.example.com + +environments: + main: + routes: + - node: + - main.example.com + main2: + routes: + - node: + - main2.example.com diff --git a/cmd/test-resources/template-ingress/test2-results/example.com.yaml b/test-resources/template-ingress/test2-results/example.com.yaml similarity index 100% rename from cmd/test-resources/template-ingress/test2-results/example.com.yaml rename to test-resources/template-ingress/test2-results/example.com.yaml diff --git a/test-resources/template-ingress/test2/docker-compose.yml b/test-resources/template-ingress/test2/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/template-ingress/test2/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/test-resources/template-ingress/test2/lagoon.yml b/test-resources/template-ingress/test2/lagoon.yml new file mode 100644 index 00000000..472999ad --- /dev/null +++ b/test-resources/template-ingress/test2/lagoon.yml @@ -0,0 +1,10 @@ +docker-compose-yaml: ../test-resources/template-ingress/test2/docker-compose.yml + +environment_variables: + git_sha: "true" + +environments: + main: + routes: + - node: + - example.com diff --git a/cmd/test-resources/template-ingress/test3-results/example.com.yaml b/test-resources/template-ingress/test3-results/example.com.yaml similarity index 100% rename from cmd/test-resources/template-ingress/test3-results/example.com.yaml rename to test-resources/template-ingress/test3-results/example.com.yaml diff --git a/test-resources/template-ingress/test3/docker-compose.yml b/test-resources/template-ingress/test3/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/template-ingress/test3/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/test-resources/template-ingress/test3/lagoon.yml b/test-resources/template-ingress/test3/lagoon.yml new file mode 100644 index 00000000..0667e9a2 --- /dev/null +++ b/test-resources/template-ingress/test3/lagoon.yml @@ -0,0 +1,10 @@ +docker-compose-yaml: ../test-resources/template-ingress/test3/docker-compose.yml + +environment_variables: + git_sha: "true" + +environments: + main: + routes: + - node: + - example.com diff --git a/cmd/test-resources/template-ingress/test4-results/example.com.yaml b/test-resources/template-ingress/test4-results/example.com.yaml similarity index 100% rename from cmd/test-resources/template-ingress/test4-results/example.com.yaml rename to test-resources/template-ingress/test4-results/example.com.yaml diff --git a/test-resources/template-ingress/test4/docker-compose.yml b/test-resources/template-ingress/test4/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/template-ingress/test4/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/test-resources/template-ingress/test4/lagoon.yml b/test-resources/template-ingress/test4/lagoon.yml new file mode 100644 index 00000000..df98473b --- /dev/null +++ b/test-resources/template-ingress/test4/lagoon.yml @@ -0,0 +1,10 @@ +docker-compose-yaml: ../test-resources/template-ingress/test4/docker-compose.yml + +environment_variables: + git_sha: "true" + +environments: + main: + routes: + - node: + - example.com diff --git a/cmd/test-resources/template-ingress/test5-results/multiproject1.com.yaml b/test-resources/template-ingress/test5-results/multiproject1.com.yaml similarity index 100% rename from cmd/test-resources/template-ingress/test5-results/multiproject1.com.yaml rename to test-resources/template-ingress/test5-results/multiproject1.com.yaml diff --git a/test-resources/template-ingress/test5/docker-compose.yml b/test-resources/template-ingress/test5/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/template-ingress/test5/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/test-resources/template-ingress/test5/lagoon.yml b/test-resources/template-ingress/test5/lagoon.yml new file mode 100644 index 00000000..82dd632f --- /dev/null +++ b/test-resources/template-ingress/test5/lagoon.yml @@ -0,0 +1,17 @@ +docker-compose-yaml: ../test-resources/template-ingress/test5/docker-compose.yml + +environment_variables: + git_sha: "true" + +multiproject1: + environments: + multiproject: + routes: + - node: + - multiproject1.com +multiproject2: + environments: + multiproject: + routes: + - node: + - multiproject2.com diff --git a/cmd/test-resources/template-ingress/test6-results/multiproject2.com.yaml b/test-resources/template-ingress/test6-results/multiproject2.com.yaml similarity index 100% rename from cmd/test-resources/template-ingress/test6-results/multiproject2.com.yaml rename to test-resources/template-ingress/test6-results/multiproject2.com.yaml diff --git a/test-resources/template-ingress/test6/docker-compose.yml b/test-resources/template-ingress/test6/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/template-ingress/test6/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/test-resources/template-ingress/test6/lagoon.yml b/test-resources/template-ingress/test6/lagoon.yml new file mode 100644 index 00000000..da8476d1 --- /dev/null +++ b/test-resources/template-ingress/test6/lagoon.yml @@ -0,0 +1,17 @@ +docker-compose-yaml: ../test-resources/template-ingress/test6/docker-compose.yml + +environment_variables: + git_sha: "true" + +multiproject1: + environments: + multiproject: + routes: + - node: + - multiproject1.com +multiproject2: + environments: + multiproject: + routes: + - node: + - multiproject2.com diff --git a/cmd/test-resources/template-ingress/test7-results/example.com.yaml b/test-resources/template-ingress/test7-results/example.com.yaml similarity index 100% rename from cmd/test-resources/template-ingress/test7-results/example.com.yaml rename to test-resources/template-ingress/test7-results/example.com.yaml diff --git a/cmd/test-resources/template-ingress/test7-results/www.example.com.yaml b/test-resources/template-ingress/test7-results/www.example.com.yaml similarity index 100% rename from cmd/test-resources/template-ingress/test7-results/www.example.com.yaml rename to test-resources/template-ingress/test7-results/www.example.com.yaml diff --git a/test-resources/template-ingress/test7/docker-compose.yml b/test-resources/template-ingress/test7/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/template-ingress/test7/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/test-resources/template-ingress/test7/lagoon.yml b/test-resources/template-ingress/test7/lagoon.yml new file mode 100644 index 00000000..a1aaed78 --- /dev/null +++ b/test-resources/template-ingress/test7/lagoon.yml @@ -0,0 +1,11 @@ +docker-compose-yaml: ../test-resources/template-ingress/test7/docker-compose.yml + +environment_variables: + git_sha: "true" + +environments: + main: + routes: + - node: + - example.com + - www.example.com diff --git a/cmd/test-resources/template-ingress/test8-results/customdomain-will-be-main-domain.com.yaml b/test-resources/template-ingress/test8-results/customdomain-will-be-main-domain.com.yaml similarity index 100% rename from cmd/test-resources/template-ingress/test8-results/customdomain-will-be-main-domain.com.yaml rename to test-resources/template-ingress/test8-results/customdomain-will-be-main-domain.com.yaml diff --git a/cmd/test-resources/template-ingress/test8-results/customdomain-will-be-not-be-main-domain.com.yaml b/test-resources/template-ingress/test8-results/customdomain-will-be-not-be-main-domain.com.yaml similarity index 100% rename from cmd/test-resources/template-ingress/test8-results/customdomain-will-be-not-be-main-domain.com.yaml rename to test-resources/template-ingress/test8-results/customdomain-will-be-not-be-main-domain.com.yaml diff --git a/test-resources/template-ingress/test8/docker-compose.yml b/test-resources/template-ingress/test8/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/template-ingress/test8/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/test-resources/template-ingress/test8/lagoon.yml b/test-resources/template-ingress/test8/lagoon.yml new file mode 100644 index 00000000..1065916a --- /dev/null +++ b/test-resources/template-ingress/test8/lagoon.yml @@ -0,0 +1,8 @@ +docker-compose-yaml: ../test-resources/template-ingress/test8/docker-compose.yml + +environments: + branch/routes: + routes: + - node: + - customdomain-will-be-main-domain.com + - customdomain-will-be-not-be-main-domain.com diff --git a/cmd/test-resources/template-ingress/test9-results/active.example.com.yaml b/test-resources/template-ingress/test9-results/active.example.com.yaml similarity index 100% rename from cmd/test-resources/template-ingress/test9-results/active.example.com.yaml rename to test-resources/template-ingress/test9-results/active.example.com.yaml diff --git a/cmd/test-resources/template-ingress/test9-results/main.example.com.yaml b/test-resources/template-ingress/test9-results/main.example.com.yaml similarity index 100% rename from cmd/test-resources/template-ingress/test9-results/main.example.com.yaml rename to test-resources/template-ingress/test9-results/main.example.com.yaml diff --git a/test-resources/template-ingress/test9/docker-compose.yml b/test-resources/template-ingress/test9/docker-compose.yml new file mode 100644 index 00000000..85386270 --- /dev/null +++ b/test-resources/template-ingress/test9/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + node: + networks: + - amazeeio-network + - default + build: + context: . + dockerfile: node.dockerfile + labels: + lagoon.type: node + volumes: + - .:/app:delegated + environment: + - LAGOON_LOCALDEV_HTTP_PORT=3000 + - LAGOON_ROUTE=http://node.docker.amazee.io + +networks: + amazeeio-network: + external: true \ No newline at end of file diff --git a/test-resources/template-ingress/test9/lagoon.yml b/test-resources/template-ingress/test9/lagoon.yml new file mode 100644 index 00000000..62de5500 --- /dev/null +++ b/test-resources/template-ingress/test9/lagoon.yml @@ -0,0 +1,24 @@ +docker-compose-yaml: ../test-resources/template-ingress/test9/docker-compose.yml + +environment_variables: + git_sha: "true" + +production_routes: + active: + routes: + - node: + - active.example.com + standby: + routes: + - node: + - standby.example.com + +environments: + main: + routes: + - node: + - main.example.com + main2: + routes: + - node: + - main2.example.com