Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

Gracefully fail if a Helm chart has missing values #287

Merged
merged 7 commits into from
Aug 9, 2018
Merged

Gracefully fail if a Helm chart has missing values #287

merged 7 commits into from
Aug 9, 2018

Conversation

ebramanti
Copy link
Contributor

What I Did

  • Return 400 on saveHelmValues if linting of Helm templates fail
  • Update UI to halt continuing if a Helm lint error is detected

How I Did it

Incorporate Helm's linter as a dependency in the project, and run against Values passed from frontend in the helm-values route. I also updated the UI to properly halt and display a 400 error if it detects a failure.

How to verify it

Try skipping values with this command:

ship init https://github.com/sourcegraph/deploy-sourcegraph 

It should fail with the error below:

[ERROR] templates/: render error in \"sourcegraph/templates/storage-class.yaml\": template: sourcegraph/templates/storage-class.yaml:2:27: executing \"sourcegraph/templates/storage-class.yaml\" at <required \".Values.cl...>: error calling required: .Values.cluster.storageClass.create is required

Description for the Changelog

  • Gracefully fail if a Helm chart has missing values

Picture of a Boat (not required but encouraged)

@ebramanti ebramanti requested a review from marccampbell August 9, 2018 00:29
Copy link
Member

@marccampbell marccampbell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jadengore should we add a test for this also?

"event", "validate.fail",
"errors", fmt.Sprintf("%+v", formattedErrors),
)
c.JSON(400, map[string]interface{}{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

400 http.StatusBadRequest ?

@@ -129,9 +136,15 @@ export default class HelmValuesEditor extends React.Component {
values: specValue
}
if(payload.values !== "" && payload.values !== initialSpecValue) {
this.setState({ saving: true });
this.setState({ saving: true, helmLintErrors: [] });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm surprised you didn't await this but lgtm.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too concerned about the errors being cleared before we make the next request

}
const body = await response.blob();
dispatch(loadingData(loaderType, false));
return body;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gonna defer to @GraysonNull on this pattern of returning the body directly vs dispatching another action

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jadengore Ideally we dispatch a new action so things stay updated in the redux store and we maintain the data flow throughout the app. What's the is the context of this? I'm unable to click in to see this change in it's context....says it can't find the commits.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talked IRL, this is all good

}
const body = await response.blob();
dispatch(loadingData(loaderType, false));
return body;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talked IRL, this is all good

@ebramanti ebramanti merged commit f43ca56 into replicatedhq:master Aug 9, 2018
@ebramanti ebramanti deleted the fix/helm-chart-values-failure branch August 9, 2018 22:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants