Skip to content

Commit

Permalink
fix: support ngrok authtoken (konstructio#2074)
Browse files Browse the repository at this point in the history
  • Loading branch information
johndietz authored and DrummyFloyd committed Mar 11, 2024
1 parent c625a5d commit 00ce3ab
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
13 changes: 13 additions & 0 deletions cmd/k3d/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand All @@ -560,6 +571,7 @@ func runK3d(cmd *cobra.Command, args []string) error {
config.MetaphorDir,
&metaphorTemplateTokens,
gitProtocolFlag,
removeAtlantis,
)
if err != nil {
return err
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit 00ce3ab

Please sign in to comment.