Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check tools and update outputs #68

Merged
merged 10 commits into from
Jul 4, 2022
Merged

Add check tools and update outputs #68

merged 10 commits into from
Jul 4, 2022

Conversation

6za
Copy link
Contributor

@6za 6za commented Jun 30, 2022

Adding some extra features to go-cli:

  • More verbose init, print info to logs and STDOUT.
  • Add checktools to validate download binaries, for compatibility check.
  • Wrapper for os.exec calls execShellReturnStrings

Signed-off-by: 6za 53096417+6za@users.noreply.github.com

Signed-off-by: 6za <53096417+6za@users.noreply.github.com>
@6za
Copy link
Contributor Author

6za commented Jun 30, 2022

Result will be logged at: ./log/log_1656619077.log
Init actions: 10 expected tasks ...

flare-cli golang utility version: v0.0.1
OS type: linux
Arch: amd64
$HOME folder: /home/developer
kubectl used: /home/developer/.kubefirst/tools/kubectl
terraform used: /home/developer/.kubefirst/tools/terraform
Kubeconfig in use: /home/developer/.kubefirst/gitops/terraform/base/kubeconfig_kubefirst
".flare" file found: /home/developer/.flare
".kubefirst" file found: /home/developer/.kubefirst
	".kubefirst" will be generated by installation process, if exist means a installation may already be executed
AWS_REGION env var not set.
AWS_REGION is recommended for execution.
-----------
1 - Load properties           ... done! [1 in 1.118s]
2 - Set .flare initial values ... done! [1 in 1.118s]
3 - Test Domain Liveness      ... done! [1 in 1.119s]
4 - Create SSH Key Pair       ... done! [1 in 1.338s]
5 - Load Templates            ...  0.0% [............................] [0 in 1.903089s]
5 - Load Templates            ... done! [1 in 1.978s]
6 - Download Tools            ... done! [3 in 5.977s]
7 - Get Account Info          ...  0.0% [............................] [0 in 6.203417s]
8 - Create Buckets            ...  0.0% [............................] [0 in 6.203428s]
9 - Detokenize                ...  0.0% [............................] [0 in 6.203435s]
10 - Send Telemetry           ...  0.0% [............................] [0 in 6.20344s]
7 - Get Account Info          ... done! [1 in 6.218s]
8 - Create Buckets            ... done! [4 in 6.233s]
9 - Detokenize                ... done! [1 in 6.248s]
10 - Send Telemetry           ... done! [1 in 6.252s]

6za added 9 commits June 30, 2022 20:15
Signed-off-by: 6za <53096417+6za@users.noreply.github.com>
Signed-off-by: 6za <53096417+6za@users.noreply.github.com>
Signed-off-by: 6za <53096417+6za@users.noreply.github.com>
Signed-off-by: 6za <53096417+6za@users.noreply.github.com>
Signed-off-by: 6za <53096417+6za@users.noreply.github.com>
Signed-off-by: 6za <53096417+6za@users.noreply.github.com>
Signed-off-by: 6za <53096417+6za@users.noreply.github.com>
Signed-off-by: 6za <53096417+6za@users.noreply.github.com>
Signed-off-by: 6za <53096417+6za@users.noreply.github.com>
@6za 6za merged commit a98418a into go-cli Jul 4, 2022
@@ -27,7 +28,7 @@ to quickly create a Cobra application.`,
// todo this needs to be removed when we are no longer in the starter account
os.Setenv("AWS_PROFILE", "starter")

fmt.Println("\n\nTODO -- need to setup and argocd delete against registry and wait?\n\n")
log.Println("\n\nTODO -- need to setup and argocd delete against registry and wait?\n\n")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the line breaks won't be necessary with Println

@@ -62,7 +63,7 @@ to quickly create a Cobra application.`,
tfInitGitlabCmd.Stderr = os.Stderr
err = tfInitGitlabCmd.Run()
if err != nil {
fmt.Println("failed to call terraform init gitlab: ", err)
log.Println("failed to call terraform init gitlab: ", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could make a single call to reduce functions size, like:
log.Panicf("failed to call terraform init GitLab: %s", err)

@@ -16,7 +17,7 @@ func setGlobals() {
tmphome, err := os.UserHomeDir()
home = tmphome
if(err != nil){
fmt.Printf("Error Defining home - %s", err)
log.Printf("Error Defining home - %s", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can do it later as well:
log.Panicf("...") instead of log + exit(1) , panic will clean up contexts, and close open http connections before exiting.

viper.Set("create.softserve.create", true)
viper.WriteConfig()
log.Println("waiting for soft-serve installation to complete...")
time.Sleep(60 * time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it could be a good idea to add a todo: to remember to update this blocker later on


err := os.Chdir(directory)
if err != nil {
log.Println("error changing dir")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we log and exit in this case?

execShellReturnStrings(terraformPath, fmt.Sprintf("%s", terraformAction), "-auto-approve")
keyOut, _, errKey := execShellReturnStrings(terraformPath, "output", "vault_unseal_kms_key")
if errKey != nil {
log.Println("failed to call tfOutputCmd.Run(): ", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we log and exit in this case?

@6za
Copy link
Contributor Author

6za commented Jul 4, 2022

Updating on the next PR:#70

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants