diff --git a/cmd/k3d/create.go b/cmd/k3d/create.go index 9cbd2eb4f..955a52463 100644 --- a/cmd/k3d/create.go +++ b/cmd/k3d/create.go @@ -369,6 +369,13 @@ func runK3d(cmd *cobra.Command, args []string) error { viper.WriteConfig() } + atlantisNgrokAuthtoken := viper.GetString("secrets.atlantis-ngrok-authtoken") + if atlantisNgrokAuthtoken == "" { + atlantisNgrokAuthtoken = os.Getenv("NGROK_AUTHTOKEN") + viper.Set("secrets.atlantis-ngrok-authtoken", atlantisNgrokAuthtoken) + viper.WriteConfig() + } + log.Info().Msg("checking authentication to required providers") // check disk @@ -544,6 +551,10 @@ func runK3d(cmd *cobra.Command, args []string) error { progressPrinter.IncrementTracker("preflight-checks", 1) progressPrinter.AddTracker("cloning-and-formatting-git-repositories", "Cloning and formatting git repositories", 1) progressPrinter.SetupProgress(progressPrinter.TotalOfTrackers(), false) + removeAtlantis := false + if viper.GetString("secrets.atlantis-ngrok-authtoken") == "" { + removeAtlantis = true + } if !viper.GetBool("kubefirst-checks.gitops-ready-to-push") { log.Info().Msg("generating your new gitops repository") err := k3d.PrepareGitRepositories( @@ -560,6 +571,7 @@ func runK3d(cmd *cobra.Command, args []string) error { config.MetaphorDir, &metaphorTemplateTokens, gitProtocolFlag, + removeAtlantis, ) if err != nil { return err @@ -1216,6 +1228,7 @@ func runK3d(cmd *cobra.Command, args []string) error { tfEnvs["AWS_SECRET_ACCESS_KEY"] = pkg.MinioDefaultPassword tfEnvs["TF_VAR_aws_access_key_id"] = pkg.MinioDefaultUsername tfEnvs["TF_VAR_aws_secret_access_key"] = pkg.MinioDefaultPassword + tfEnvs["TF_VAR_ngrok_authtoken"] = viper.GetString("secrets.atlantis-ngrok-authtoken") // tfEnvs["TF_LOG"] = "DEBUG" tfEntrypoint := config.GitopsDir + "/terraform/vault" diff --git a/go.mod b/go.mod index c9075914f..b5b8dcc5d 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/hashicorp/vault/api v1.9.0 github.com/kubefirst/kubefirst-api v0.1.9 github.com/kubefirst/metrics-client v0.3.0 - github.com/kubefirst/runtime v0.3.37 + github.com/kubefirst/runtime v0.4.0 github.com/nxadm/tail v1.4.8 github.com/rs/zerolog v1.29.1 github.com/sirupsen/logrus v1.9.0 diff --git a/go.sum b/go.sum index 3c21219db..92ff137d6 100644 --- a/go.sum +++ b/go.sum @@ -723,8 +723,8 @@ github.com/kubefirst/kubefirst-api v0.1.9 h1:HCPO2usOW64NS3B/zRL84qfADBNFfcbeKd3 github.com/kubefirst/kubefirst-api v0.1.9/go.mod h1:hik4k99JDLrxxh25jYt6eYxYPhIodX1yxb4gh5tfJ3U= github.com/kubefirst/metrics-client v0.3.0 h1:zCug82pEzeWhHhpeYQvdhytRNDxrLxX18dPQ5PSxY3s= github.com/kubefirst/metrics-client v0.3.0/go.mod h1:GR7wsMcyYhd+EU67PeuMCBYFE6OJ7P/j5OI5BLOoRMc= -github.com/kubefirst/runtime v0.3.37 h1:OaDcdlsRHMbgwu8T1/Z5etFtambEmlkZMW8WH/3J2z4= -github.com/kubefirst/runtime v0.3.37/go.mod h1:0CnYy+8JTG+/0f3QlkTQJqTT654Su6JXk30OufFVY98= +github.com/kubefirst/runtime v0.4.0 h1:BQzls1f6l5kV0uDcjp71GwM1x6xl3czX0jGkUu3e2AQ= +github.com/kubefirst/runtime v0.4.0/go.mod h1:0CnYy+8JTG+/0f3QlkTQJqTT654Su6JXk30OufFVY98= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/libopenstorage/openstorage v1.0.0/go.mod h1:Sp1sIObHjat1BeXhfMqLZ14wnOzEhNx2YQedreMcUyc= github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhnIaL+V+BEER86oLrvS+kWobKpbJuye0=