From 2c496018544ce53b838cef93d5bee6b3dee0d1f4 Mon Sep 17 00:00:00 2001 From: Jan Date: Wed, 27 Nov 2019 14:35:52 +0100 Subject: [PATCH] Fix #1103: Use ENV variables instead of empty strings --- e2e/test_support.go | 4 ---- pkg/cmd/install.go | 14 ++++++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/e2e/test_support.go b/e2e/test_support.go index 1be93c369b..0aea714e73 100644 --- a/e2e/test_support.go +++ b/e2e/test_support.go @@ -87,10 +87,6 @@ func kamel(args ...string) *cobra.Command { var c *cobra.Command var err error - kamelArgs := os.Getenv("KAMEL_ARGS") - kamelDefaultArgs := strings.Fields(kamelArgs) - args = append(kamelDefaultArgs, args...) - kamelBin := os.Getenv("KAMEL_BIN") if kamelBin != "" { fmt.Printf("Using external kamel binary on path %s\n", kamelBin) diff --git a/pkg/cmd/install.go b/pkg/cmd/install.go index 2f54088df4..0a9086b805 100644 --- a/pkg/cmd/install.go +++ b/pkg/cmd/install.go @@ -19,6 +19,7 @@ package cmd import ( "fmt" + "os" "regexp" "strings" "time" @@ -66,10 +67,10 @@ func newCmdInstall(rootCmdOptions *RootCmdOptions) *cobra.Command { cmd.Flags().StringVar(&impl.registry.Secret, "registry-secret", "", "A secret used to push/pull images to the Docker registry") cmd.Flags().BoolVar(&impl.registry.Insecure, "registry-insecure", false, "Configure to configure registry access in insecure mode or not") cmd.Flags().StringSliceVarP(&impl.properties, "property", "p", nil, "Add a camel property") - cmd.Flags().StringVar(&impl.camelVersion, "camel-version", "", "Set the camel version") + cmd.Flags().StringVar(&impl.camelVersion, "camel-version", os.Getenv("KAMEL_CAMEL_VERSION"), "Set the camel version") cmd.Flags().StringVar(&impl.runtimeVersion, "runtime-version", "", "Set the camel-k runtime version") - cmd.Flags().StringVar(&impl.baseImage, "base-image", "", "Set the base image used to run integrations") - cmd.Flags().StringVar(&impl.operatorImage, "operator-image", "", "Set the operator image used for the operator deployment") + cmd.Flags().StringVar(&impl.baseImage, "base-image", os.Getenv("KAMEL_BASE_IMAGE"), "Set the base image used to run integrations") + cmd.Flags().StringVar(&impl.operatorImage, "operator-image", os.Getenv("KAMEL_OPERATOR_IMAGE"), "Set the operator image used for the operator deployment") cmd.Flags().StringSliceVar(&impl.kits, "kit", nil, "Add an integration kit to build at startup") cmd.Flags().StringVar(&impl.buildStrategy, "build-strategy", "", "Set the build strategy") cmd.Flags().StringVar(&impl.buildTimeout, "build-timeout", "", "Set how long the build process can last") @@ -79,9 +80,10 @@ func newCmdInstall(rootCmdOptions *RootCmdOptions) *cobra.Command { "(HTTP_PROXY|HTTPS_PROXY|NO_PROXY)") // maven settings - cmd.Flags().StringVar(&impl.localRepository, "local-repository", "", "Location of the local maven repository") - cmd.Flags().StringVar(&impl.mavenSettings, "maven-settings", "", "Configure the source of the maven settings (configmap|secret:name[/key])") - cmd.Flags().StringSliceVar(&impl.mavenRepositories, "maven-repository", nil, "Add a maven repository") + cmd.Flags().StringVar(&impl.localRepository, "local-repository", os.Getenv("KAMEL_LOCAL_REPOSITORY"), "Location of the local maven repository") + cmd.Flags().StringVar(&impl.mavenSettings, "maven-settings", os.Getenv("KAMEL_MAVEN_SETTINGS"), "Configure the source of the maven settings (configmap|secret:name[/key])") + kamelMavenRepository := strings.Split(os.Getenv("KAMEL_MAVEN_REPOSITORY"), ",") + cmd.Flags().StringSliceVar(&impl.mavenRepositories, "maven-repository", kamelMavenRepository, "Add a maven repository") // completion support configureBashAnnotationForFlag(