Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions template/.github/workflows/build.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,31 @@ jobs:
outputs:
detected: ${{ steps.check.outputs.detected }}

helm-lint:
name: Lint Helm Chart
needs:
- detect-changes
if: needs.detect-changes.outputs.detected == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

# Validates the chart templates and, where a values.schema.json exists, the
# default values against it.
#
# The chart cannot render without a registry overlay, because image.repository
# is only set there.
- name: Lint Helm Chart
env:
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"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

done

cargo-udeps:
name: Run cargo-udeps
if: needs.detect-changes.outputs.detected == 'true'
Expand Down Expand Up @@ -384,6 +409,7 @@ jobs:
needs:
- detect-changes
- cargo-udeps
- helm-lint
- build-container-image
- publish-index-manifest
- provenance-oci
Expand Down