-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: CLI license Diagnostics (#6040)
* feat: diagnostics * feat: diagnostics * chore: changed results * chore: removed mess * feat: CLI renderer updates * feat: CLI renderer updates -k adahsjdhsajh * fix: golang ci fixes * feat: added deps * feat: offline license validation * feat: added separated commands * validators update * feat: ui polishing * fix: go mod tidy * fix: golang ci fixes and moving public key to be set through build process
- Loading branch information
Showing
40 changed files
with
1,747 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package commands | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
|
||
commands "github.com/kubeshop/testkube/cmd/kubectl-testkube/commands/diagnostics" | ||
"github.com/kubeshop/testkube/pkg/diagnostics" | ||
"github.com/kubeshop/testkube/pkg/ui" | ||
) | ||
|
||
// NewDebugCmd creates the 'testkube debug' command | ||
func NewDiagnosticsCmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "diagnostics", | ||
Aliases: []string{"diagnose", "diag", "di"}, | ||
Short: "Diagnoze testkube issues with ease", | ||
Run: NewRunDiagnosticsCmdFunc(), | ||
} | ||
|
||
cmd.Flags().StringP("key-override", "k", "", "Pass License key manually (we will not try to locate it automatically)") | ||
cmd.Flags().StringP("file-override", "f", "", "Pass License file manually (we will not try to locate it automatically)") | ||
|
||
cmd.AddCommand(commands.NewLicenseCheckCmd()) | ||
cmd.AddCommand(commands.NewInstallCheckCmd()) | ||
|
||
return cmd | ||
} | ||
|
||
func NewRunDiagnosticsCmdFunc() func(cmd *cobra.Command, args []string) { | ||
return func(cmd *cobra.Command, args []string) { | ||
d := diagnostics.New() | ||
|
||
commands.RegisterInstallValidators(cmd, d) | ||
commands.RegisterLicenseValidators(cmd, d) | ||
|
||
err := d.Run() | ||
ui.ExitOnError("Running validations", err) | ||
ui.NL(2) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package diagnostics | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/kubeshop/testkube/pkg/diagnostics" | ||
"github.com/kubeshop/testkube/pkg/diagnostics/validators/deps" | ||
"github.com/kubeshop/testkube/pkg/ui" | ||
) | ||
|
||
func RegisterInstallValidators(_ *cobra.Command, d diagnostics.Diagnostics) { | ||
depsGroup := d.AddValidatorGroup("install.dependencies", nil) | ||
depsGroup.AddValidator(deps.NewKubectlDependencyValidator()) | ||
depsGroup.AddValidator(deps.NewHelmDependencyValidator()) | ||
} | ||
|
||
func NewInstallCheckCmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "install", | ||
Aliases: []string{"ins", "i"}, | ||
Short: "Diagnose pre-installation dependencies", | ||
Run: RunInstallCheckFunc(), | ||
} | ||
|
||
cmd.Flags().StringP("key-override", "k", "", "Pass License key manually (we will not try to locate it automatically)") | ||
cmd.Flags().StringP("file-override", "f", "", "Pass License file manually (we will not try to locate it automatically)") | ||
|
||
return cmd | ||
} | ||
|
||
func RunInstallCheckFunc() func(cmd *cobra.Command, args []string) { | ||
return func(cmd *cobra.Command, args []string) { | ||
d := diagnostics.New() | ||
RegisterInstallValidators(cmd, d) | ||
|
||
err := d.Run() | ||
ui.ExitOnError("Running validations", err) | ||
ui.NL(2) | ||
} | ||
} |
Oops, something went wrong.