From 03c2bcb290b938e47dd4cb04d4a5211b836339d0 Mon Sep 17 00:00:00 2001 From: rick <1450685+LinuxSuRen@users.noreply.github.com> Date: Tue, 23 Nov 2021 15:53:42 +0800 Subject: [PATCH 1/2] Avoid to set the password of Jenkins to be empty --- kubectl-plugin/config/migrate.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kubectl-plugin/config/migrate.go b/kubectl-plugin/config/migrate.go index 004c678..fd52e7b 100644 --- a/kubectl-plugin/config/migrate.go +++ b/kubectl-plugin/config/migrate.go @@ -55,7 +55,9 @@ func (o *migrateOption) runE(cmd *cobra.Command, args []string) (err error) { } var password string - if password, err = o.getDevOpsPassword(); err == nil { + if password, err = o.getDevOpsPassword(); password == "" { + err = fmt.Errorf("the password of Jenkins is empty") + } else if err == nil { err = o.updateKubeSphereConfig("devops-config", o.namespace, map[string]interface{}{ "password": password, }) From 051f86208348e2da1c2972232bcd41a6a7b2e14c Mon Sep 17 00:00:00 2001 From: rick <1450685+LinuxSuRen@users.noreply.github.com> Date: Wed, 24 Nov 2021 11:38:45 +0800 Subject: [PATCH 2/2] Fix the error might be overwrited issue --- kubectl-plugin/config/migrate.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kubectl-plugin/config/migrate.go b/kubectl-plugin/config/migrate.go index fd52e7b..e1eeca8 100644 --- a/kubectl-plugin/config/migrate.go +++ b/kubectl-plugin/config/migrate.go @@ -56,7 +56,11 @@ func (o *migrateOption) runE(cmd *cobra.Command, args []string) (err error) { var password string if password, err = o.getDevOpsPassword(); password == "" { - err = fmt.Errorf("the password of Jenkins is empty") + if err == nil { + err = fmt.Errorf("the password of Jenkins is empty") + } else { + err = fmt.Errorf("the password of Jenkins is empty, it might caused by: %v", err) + } } else if err == nil { err = o.updateKubeSphereConfig("devops-config", o.namespace, map[string]interface{}{ "password": password,