From a7f7b7617cf9b7040c33e2d3e1d4d58062fd5183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Vanzuita?= Date: Thu, 24 Nov 2022 10:42:21 -0300 Subject: [PATCH] chore: clean up MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Vanzuita --- cmd/destroyLocalGithub.go | 1 - cmd/local/local.go | 4 ---- internal/argocd/argocd.go | 19 +++++++++---------- pkg/helpers.go | 2 +- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/cmd/destroyLocalGithub.go b/cmd/destroyLocalGithub.go index d2950bc99..265020c7c 100644 --- a/cmd/destroyLocalGithub.go +++ b/cmd/destroyLocalGithub.go @@ -30,7 +30,6 @@ var destroyLocalGithubCmd = &cobra.Command{ Short: "A brief description of your command", Long: `TDB`, RunE: func(cmd *cobra.Command, args []string) error { - fmt.Println("destroy-local-github called") config := configs.ReadConfig() destroyFlags, err := flagset.ProcessDestroyFlags(cmd) diff --git a/cmd/local/local.go b/cmd/local/local.go index 64f0e2cee..8855a7901 100644 --- a/cmd/local/local.go +++ b/cmd/local/local.go @@ -100,7 +100,6 @@ func runLocal(cmd *cobra.Command, args []string) error { // todo need to add go channel to control when ngrok should close // and use context to handle closing the open goroutine/connection go pkg.RunNgrok(context.TODO(), pkg.LocalAtlantisURL) - time.Sleep(5 * time.Second) if !viper.GetBool("kubefirst.done") { if viper.GetString("gitprovider") == "github" { @@ -276,9 +275,6 @@ func runLocal(cmd *cobra.Command, args []string) error { k8s.LoopUntilPodIsReady(dryRun) - // todo: can I remove it? - time.Sleep(20 * time.Second) - // configure vault with terraform executionControl = viper.GetBool("terraform.vault.apply.complete") if !executionControl { diff --git a/internal/argocd/argocd.go b/internal/argocd/argocd.go index d810f8b46..6a261ed07 100644 --- a/internal/argocd/argocd.go +++ b/internal/argocd/argocd.go @@ -319,21 +319,20 @@ func ApplyRegistry(dryRun bool) error { func ApplyRegistryLocal(dryRun bool) error { config := configs.ReadConfig() - if viper.GetBool("argocd.registry.applied") { + if viper.GetBool("argocd.registry.applied") || dryRun { log.Println("skipped ApplyRegistryLocal - ") return nil } - if !dryRun { - _, _, err := pkg.ExecShellReturnStrings(config.KubectlClientPath, "--kubeconfig", config.KubeConfigPath, "-n", "argocd", "apply", "-f", fmt.Sprintf("%s/gitops/registry.yaml", config.K1FolderPath)) - if err != nil { - log.Printf("failed to execute localhost kubectl apply of registry-base: %s", err) - return err - } - time.Sleep(45 * time.Second) - viper.Set("argocd.registry.applied", true) - viper.WriteConfig() + _, _, err := pkg.ExecShellReturnStrings(config.KubectlClientPath, "--kubeconfig", config.KubeConfigPath, "-n", "argocd", "apply", "-f", fmt.Sprintf("%s/gitops/registry.yaml", config.K1FolderPath)) + if err != nil { + log.Printf("failed to execute localhost kubectl apply of registry-base: %s", err) + return err } + time.Sleep(45 * time.Second) + viper.Set("argocd.registry.applied", true) + viper.WriteConfig() + return nil } diff --git a/pkg/helpers.go b/pkg/helpers.go index 2dc86dc2d..fe5a9a03e 100644 --- a/pkg/helpers.go +++ b/pkg/helpers.go @@ -574,7 +574,7 @@ func UpdateTerraformS3BackendForLocalhostAddress() error { "http://minio.minio.svc.cluster.local:9000", MinioURL, ); err != nil { - return err + log.Println(err) } }