mirror of
https://github.com/kubescape/kubescape.git
synced 2026-04-12 13:47:04 +00:00
* add print in the cli to which version the kubescape was update Signed-off-by: rcohencyberarmor <rcohen@armosec.io> * update will suggest to our user to update by following kubescape installation guide Signed-off-by: rcohencyberarmor <rcohen@armosec.io> --------- Signed-off-by: rcohencyberarmor <rcohen@armosec.io> Co-authored-by: rcohencyberarmor <rcohen@armosec.io>
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package update
|
|
|
|
//This update command updates to the latest kubescape release.
|
|
//Example:-
|
|
// kubescape update
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
logger "github.com/kubescape/go-logger"
|
|
"github.com/kubescape/kubescape/v2/core/cautils"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
const (
|
|
installationLink string = "https://github.com/kubescape/kubescape/blob/master/docs/installation.md"
|
|
)
|
|
|
|
var updateCmdExamples = fmt.Sprintf(`
|
|
# Update to the latest kubescape release
|
|
%[1]s update
|
|
`, cautils.ExecName())
|
|
|
|
func GetUpdateCmd() *cobra.Command {
|
|
updateCmd := &cobra.Command{
|
|
Use: "update",
|
|
Short: "Update your version",
|
|
Long: ``,
|
|
Example: updateCmdExamples,
|
|
RunE: func(_ *cobra.Command, args []string) error {
|
|
//Checking the user's version of kubescape to the latest release
|
|
if cautils.BuildNumber == cautils.LatestReleaseVersion {
|
|
//your version == latest version
|
|
logger.L().Info(("You are in the latest version"))
|
|
} else {
|
|
fmt.Printf("please refer to our installation docs in the following link: %s", installationLink)
|
|
}
|
|
return nil
|
|
},
|
|
}
|
|
return updateCmd
|
|
}
|