check mode for CI runs
Closed this issue · 6 comments
It would be cool to have a check mode that verifies that a given schema matches the one generated through the given inputs. This could be used to verify that developers did not forget to re-generate a schema when they change inputs.
@sebhoss Is there anything missing your use case from integration section is README.md file?
We don't use GitHub but GitLab - I'm basically asking for the fail-on-diff feature of the GitHub action to be available in the CLI itself
@sebhoss thank you for the suggestion! It sure sounds as reasonable request. I'm afraid best option for now is pre-commit
hook even though it's hard to verify that every developer has installed it. I can't promise anything short-term but maybe in some future release we can add some kind of validations with CLI flags to be used in CI/CD.
Sounds good?
Yeah of course! I have written a small script that performs the comparison in our pipelines so I don't have an immediate need for it anymore.
That said, would a -check
flag that instructs the CLI to compare its generated output with what is inside -output
instead of writing to that file be of interest to you?
@sebhoss Since you mentioned that you already have a script, the most efficient way would be to add section under integrations in README.md as generic CI example
It's not really generic and kinda involved in our case since we are using GitLab components, but a trimmed down version looks like this:
schema-check:
script:
- cd path/to/helm/chart
- helm schema -output generated-schema.json
- CURRENT_SCHEMA=$(cat values.schema.json)
- GENERATED_SCHEMA=$(cat generated-schema.json)
- |
if [ "$CURRENT_SCHEMA" != "$GENERATED_SCHEMA" ]; then
echo "Schema must be re-generated! Run 'helm schema' in the helm-chart directory" 1>&2
exit 1
fi