feat: Add a helm-lint job to the build workflow - #635
Conversation
See hive-operator#743 which already tested this for Hive. helm lint validates the chart templates and, where a values.schema.json exists, the default values against it.
Techassi
left a comment
There was a problem hiding this comment.
Approved in general, just one question.
| CHART_DIRECTORY: deploy/helm/{[ operator.name }] | ||
| run: | | ||
| for registry in oci.stackable.tech quay.io; do | ||
| helm lint "$CHART_DIRECTORY" --values "$CHART_DIRECTORY/values/${registry}.yaml" |
There was a problem hiding this comment.
I feel like this shouldn't work or does helm pick up the values.yaml file automatically?
Because the overlay only contains a single field (image.reposiotry). Ideally they files should be merged first, or both the regular values.yaml file and the overlay should be provided via --values.
There was a problem hiding this comment.
You give it the chart directory as the first parameter.
deploy/helm/hive-operator on HEAD (8a9af6f) [?] is v0.0.0-dev via ⎈ v4.2.2
❯ helm lint .
==> Linting .
[INFO] Chart.yaml: icon is recommended
[ERROR] templates/deployment.yaml: unable to parse YAML: error converting YAML to JSON: yaml: line 25: found character that cannot start any token
Error: 1 chart(s) linted, 1 chart(s) failed
deploy/helm/hive-operator on HEAD (8a9af6f) [?] is v0.0.0-dev via ⎈ v4.2.2
deploy/helm/hive-operator on HEAD (8a9af6f) [?] is v0.0.0-dev via ⎈ v4.2.2
❯ helm lint . --values values/oci.stackable.tech.yaml
==> Linting .
[INFO] Chart.yaml: icon is recommended
1 chart(s) linted, 0 chart(s) failed
deploy/helm/hive-operator on HEAD (8a9af6f) [?] is v0.0.0-dev via ⎈ v4.2.2
❯ echo "kaput!!(:#}/{}\}…[}" | save values.yaml --append
deploy/helm/hive-operator on HEAD (8a9af6f) [!?] is v0.0.0-dev via ⎈ v4.2.2
deploy/helm/hive-operator on HEAD (8a9af6f) [!?] is v0.0.0-dev via ⎈ v4.2.2 took 2s
❯ helm lint . --values values/oci.stackable.tech.yaml
==> Linting .
[INFO] Chart.yaml: icon is recommended
[ERROR] values.yaml: unable to parse YAML: error converting YAML to JSON: yaml: line 77: could not find expected ':'
[ERROR] templates/: cannot load values.yaml: cannot unmarshal yaml document: error converting YAML to JSON: yaml: line 75: could not find expected ':'
[ERROR] : unable to load chart
cannot load values.yaml: cannot unmarshal yaml document: error converting YAML to JSON: yaml: line 75: could not find expected ':'
Error: 1 chart(s) linted, 1 chart(s) failed
deploy/helm/hive-operator on HEAD (8a9af6f) [!?] is v0.0.0-dev via ⎈ v4.2.2
deploy/helm/hive-operator on HEAD (8a9af6f) [!?] is v0.0.0-dev via ⎈ v4.2.2
❯ helm lint .
==> Linting .
[INFO] Chart.yaml: icon is recommended
[ERROR] values.yaml: unable to parse YAML: error converting YAML to JSON: yaml: line 77: could not find expected ':'
[ERROR] templates/: cannot load values.yaml: cannot unmarshal yaml document: error converting YAML to JSON: yaml: line 75: could not find expected ':'
[ERROR] : unable to load chart
cannot load values.yaml: cannot unmarshal yaml document: error converting YAML to JSON: yaml: line 75: could not find expected ':'
Error: 1 chart(s) linted, 1 chart(s) failed
So, it already works as you expect it to.
It merges during linting and it checks both overlays.
Spoiler alert: It won't work :) |
It works differently than I expected. Let's see |
Ports the
helm-lintjob from stackabletech/hive-operator#743 into the templatehelm lintvalidates the chart templates and, where avalues.schema.jsonexists, the default values against it. The chart cannot render without a registry overlay, becauseimage.repositoryis only set there, so both published registries are linted.Stacked on #634, which ports stackabletech/hive-operator#742.
This is my first time trying the stacked PR feature...so...no idea how that works until I try.