@@ -110,8 +110,6 @@ func Upgrade(flagVersion string, testmode bool, log log.Logger) error {
110
110
if devops && cv .Name == common .DefaultZentaoPaasName {
111
111
deploy := defaultValue ["deploy" ]
112
112
product := deploy .(map [string ]interface {})["product" ]
113
- versions := deploy .(map [string ]interface {})["versions" ]
114
- appoldVersion := versions .(map [string ]interface {})[product .(string )]
115
113
switch product {
116
114
case common .ZenTaoBizType .String ():
117
115
selectItems = selectItems [1 :]
@@ -120,7 +118,7 @@ func Upgrade(flagVersion string, testmode bool, log log.Logger) error {
120
118
case common .ZenTaoIPDType .String ():
121
119
selectItems = selectItems [3 :]
122
120
}
123
- log .Infof ("current version: %v(%v) " , product , appoldVersion )
121
+ log .Infof ("current version: %v" , product )
124
122
selectApp := promptui.Select {
125
123
Label : "select upgrade version" ,
126
124
Items : selectItems ,
@@ -134,17 +132,18 @@ func Upgrade(flagVersion string, testmode bool, log log.Logger) error {
134
132
}
135
133
it , _ , _ := selectApp .Run ()
136
134
newProduct := selectItems [it ].Key .String ()
137
- defaultValue ["deploy" ].(map [string ]interface {})["product" ] = newProduct
138
135
appnewVersion := common .GetVersion (true , newProduct , "" )
139
136
if ! (selectItems [it ].Key == common .ZenTaoOSSType || selectItems [it ].Key == common .ZenTaoOldOSSType ) {
140
137
appnewVersion = fmt .Sprintf ("%s%s.k8s" , newProduct , common .GetVersion (true , newProduct , "" ))
141
138
if newProduct != product .(string ) {
142
139
log .Warn ("切换版本升级(如开源版升级到企业版), 可能导致因版本授权问题无法正常使用, 如有问题请联系技术支持!" )
143
140
}
144
141
}
145
- defaultValue ["deploy" ].(map [string ]interface {})["versions" ].(map [string ]interface {})[product .(string )] = appnewVersion
146
- log .Infof ("devops mode, product: %v, oldversion: %v, newversion: %v" , product , appoldVersion , appnewVersion )
147
- msg := fmt .Sprintf ("Are you sure to upgrade from %v(%v) to %v(%v)" , product , appoldVersion , selectItems [it ].Key .String (), appnewVersion )
142
+ defaultValue ["deploy" ] = map [string ]any {
143
+ "product" : newProduct ,
144
+ }
145
+ log .Debugf ("devops mode, product: %v, version: %v" , product , appnewVersion )
146
+ msg := fmt .Sprintf ("Are you sure to upgrade to %v(%v)" , selectItems [it ].Key .String (), appnewVersion )
148
147
status , _ := confirm .Confirm (msg )
149
148
if ! status {
150
149
log .Warnf ("upgrade %s canceled" , cv .Name )
@@ -156,7 +155,7 @@ func Upgrade(flagVersion string, testmode bool, log log.Logger) error {
156
155
}
157
156
}
158
157
}
159
- if _ , err := helmClient .Upgrade (cv .Name , common .DefaultHelmRepoName , cv .Name , "" , defaultValue ); err != nil {
158
+ if _ , err := helmClient .Upgrade (cv .Name , common .DefaultHelmRepoName , cv .Name , "" , defaultValue , false ); err != nil {
160
159
log .Warnf ("upgrade %s failed, reason: %v" , cv .Name , err )
161
160
} else {
162
161
log .Donef ("upgrade %s success" , cv .Name )
0 commit comments