added skip vetify of server cert

This commit is contained in:
2026-02-21 14:07:19 +02:00
parent 7be3cf8de7
commit b2c60c41c4
15 changed files with 113 additions and 94 deletions
+9 -7
View File
@@ -52,6 +52,7 @@ func (util *ImageUtil) CreateImageCmds() *cobra.Command {
subCmd.PersistentFlags().StringVarP(&util.commonImageParams.Username, "user", "u", "", "Username")
subCmd.PersistentFlags().StringVarP(&util.commonImageParams.Password, "pass", "p", "", "Password")
subCmd.PersistentFlags().Uint64VarP(&util.commonImageParams.Timeout, "timeout", "t", defaultTimeout, "Operation timeout")
subCmd.PersistentFlags().BoolVarP(&util.commonImageParams.SkipTLSVerify, "skipVerify", "S", true, "Skip server certificate verify")
subCmd.MarkFlagsRequiredTogether("user", "pass")
vi := viper.New()
@@ -109,9 +110,10 @@ type ImageUtil struct {
}
type CommonImageParams struct {
Timeout uint64
Username string
Password string
Timeout uint64
Username string
Password string
SkipTLSVerify bool
}
// PushImage
@@ -135,7 +137,7 @@ func (util *ImageUtil) pushImage(common *CommonImageParams, params *PushImagePar
ctx := context.Background()
res := &PushImageResult{}
cli := client.NewClient()
cli := client.NewClient(common.SkipTLSVerify)
timeout := time.Duration(common.Timeout) * time.Second
params.Imagepath, err = packUserinfo(params.Imagepath, common.Username, common.Password)
if err != nil {
@@ -169,7 +171,7 @@ func (util *ImageUtil) imageInfo(common *CommonImageParams, params *ImageInfoPar
res := &ImageInfoResult{}
ctx := context.Background()
cli := client.NewClient()
cli := client.NewClient(common.SkipTLSVerify)
timeout := time.Duration(common.Timeout) * time.Second
params.Imagepath, err = packUserinfo(params.Imagepath, common.Username, common.Password)
@@ -209,7 +211,7 @@ func (util *ImageUtil) pullImage(common *CommonImageParams, params *PullImagePar
ctx := context.Background()
res := &PullImageResult{}
cli := client.NewClient()
cli := client.NewClient(common.SkipTLSVerify)
timeout := time.Duration(common.Timeout) * time.Second
params.Imagepath, err = packUserinfo(params.Imagepath, common.Username, common.Password)
if err != nil {
@@ -249,7 +251,7 @@ func (util *ImageUtil) deleteImage(common *CommonImageParams, params *DeleteImag
res := &DeleteImageResult{}
ctx := context.Background()
cli := client.NewClient()
cli := client.NewClient(common.SkipTLSVerify)
timeout := time.Duration(common.Timeout) * time.Second
params.Imagepath, err = packUserinfo(params.Imagepath, common.Username, common.Password)