Просмотр исходного кода

add error handling to releases, case for empty entry value

Alexander Belanger 5 лет назад
Родитель
Сommit
e6d43aade1

+ 4 - 4
dashboard/src/components/values-form/KeyValueArray.tsx

@@ -108,7 +108,7 @@ export default class KeyValueArray extends Component<PropsType, StateType> {
                   let obj = this.valuesToObject();
                   this.props.setValues(obj);
                 }}
-                disabled={this.props.disabled || entry.value.includes("PORTERSECRET") }
+                disabled={this.props.disabled || entry?.value?.includes("PORTERSECRET") }
               />
               <Spacer />
               <Input
@@ -122,11 +122,11 @@ export default class KeyValueArray extends Component<PropsType, StateType> {
                   let obj = this.valuesToObject();
                   this.props.setValues(obj);
                 }}
-                disabled={this.props.disabled || entry.value.includes("PORTERSECRET") }
-                type={entry.value.includes("PORTERSECRET") ? "password" : "text"}
+                disabled={this.props.disabled || entry?.value?.includes("PORTERSECRET") }
+                type={entry?.value?.includes("PORTERSECRET") ? "password" : "text"}
               />
               {this.renderDeleteButton(i)}
-              {this.renderHiddenOption(entry.value.includes("PORTERSECRET"), i)}
+              {this.renderHiddenOption(entry?.value?.includes("PORTERSECRET"), i)}
             </InputWrapper>
           );
         })}

+ 7 - 2
server/api/release_handler.go

@@ -793,7 +793,7 @@ func (app *App) HandleReleaseDeployWebhook(w http.ResponseWriter, r *http.Reques
 		app.handleErrorFormDecoding(err, ErrReleaseDecode, w)
 		return
 	}
-	
+
 	form := &forms.UpgradeReleaseForm{
 		ReleaseForm: &forms.ReleaseForm{
 			Form: &helm.Form{
@@ -836,7 +836,7 @@ func (app *App) HandleReleaseDeployWebhook(w http.ResponseWriter, r *http.Reques
 	image["repository"] = repository
 	image["tag"] = commit
 	rel.Config["image"] = image
-	
+
 	if rel.Config["auto_deploy"] == false {
 		app.sendExternalError(err, http.StatusInternalServerError, HTTPError{
 			Code:   ErrReleaseDeploy,
@@ -1047,6 +1047,7 @@ func (app *App) getAgentFromQueryParams(
 		err := f(vals, app.Repo.Cluster)
 
 		if err != nil {
+			app.handleErrorInternal(err, w)
 			return nil, err
 		}
 	}
@@ -1078,6 +1079,10 @@ func (app *App) getAgentFromReleaseForm(
 		agent, err = helm.GetAgentOutOfClusterConfig(form.Form, app.Logger)
 	}
 
+	if err != nil {
+		app.handleErrorInternal(err, w)
+	}
+
 	return agent, err
 }