From 2d300d734431f121b87d4cf585999059ec2d55ab Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Sat, 25 Apr 2020 12:08:20 +0300 Subject: [PATCH] Add semver condition to check output --- cmd/tk/check.go | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/cmd/tk/check.go b/cmd/tk/check.go index be552e22..02e6f434 100644 --- a/cmd/tk/check.go +++ b/cmd/tk/check.go @@ -32,27 +32,34 @@ func init() { } func runCheckCmd(cmd *cobra.Command, args []string) error { + checkFailed := false if !sshCheck() { - os.Exit(1) + checkFailed = true } - if !kubectlCheck(">=1.14.0") { - os.Exit(1) + if !kubectlCheck(">=1.18.0") { + checkFailed = true } if !kustomizeCheck(">=3.5.0") { - os.Exit(1) + checkFailed = true } if checkPre { + if checkFailed { + os.Exit(1) + } fmt.Println(`✔`, "all prerequisites checks passed") return nil } if !kubernetesCheck(">=1.14.0") { - os.Exit(1) + checkFailed = true } + if checkFailed { + os.Exit(1) + } fmt.Println(`✔`, "all checks passed") return nil } @@ -97,7 +104,7 @@ func kubectlCheck(version string) bool { return false } - fmt.Println(`✔`, "kubectl", v.String()) + fmt.Println(`✔`, "kubectl", v.String(), version) return true } @@ -134,7 +141,7 @@ func kustomizeCheck(version string) bool { return false } - fmt.Println(`✔`, "kustomize", v.String()) + fmt.Println(`✔`, "kustomize", v.String(), version) return true } @@ -163,6 +170,6 @@ func kubernetesCheck(version string) bool { return false } - fmt.Println(`✔`, "kubernetes", v.String()) + fmt.Println(`✔`, "kubernetes", v.String(), version) return true }