<#19966 Helm linter is not instantiating templates...
# github-notifications
c
#19966 Helm linter is not instantiating templates correctly, balking on dependencies. Issue created by originalrkk We have the following files in a directory:
Copy code
common/BUILD                      -- Just helm_chart().
common/Chart.yaml                 -- Nothing interesting.
common/values.yaml                -- Contains 'value_a: a' (a semantically required value)
common/templates/_cronJob.yaml    -- Wrapped in `{{- define "common.cronjob.tpl" -}}`;
                                  -- otherwise typical and needs .Values.value_a, value_b, value_c.

actual-project/BUILD                      -- Just helm_chart().
actual-project/Chart.yaml                 -- Contains dependency `file://../common/`
actual-project/values.yaml                -- Contains 'value_b: b' (a semantically required value)
actual-project/values.schema.json         -- Describes 'value_a', 'value_b', 'value_c' as required.
actual-project/templates/cronJob.yaml     -- Just `{{- include "common.cronjob.tpl" . -}}`.
actual-project/actual-task/values.yaml    -- Contains 'value_c: c' (a semantically required value)
A BUILD file at the root of this contains:
Copy code
helm_deployment(
    name = 'actual-project-actual-task-prod',
    dependencies = ['//path/to/actual-project:actual-project'],
    sources = [
        'common/values.yaml',
        'actual-project/values.yaml',
        'actual-project/actual-task/values.yaml',
    ],
    tags = ['actual-project'],
)
(It would also be nice if these rules could live in each project directory, but that's a separate issue, i.e. supporting a reference to
../common/values.yaml
the same way Chart.yaml supports
file://../common/
.) Anyway, when running linting in this setup, such as
pants lint --only=helm actual_project::
, this generates errors such as this:
Copy code
[ERROR] templates/: template: actual-project/templates/cronJob.yaml:X:XX: executing "actual-project/templates/cronJob.yaml" at <.Values.value_c>: wrong type for value; expected string; got interface {}
Or this:
Copy code
[ERROR] templates/: template: actual-project/templates/cronJob.yaml:X:XX: executing "actual-project/templates/cronJob.yaml" at <include "common.cronjob.tpl" .>: error calling include: template: actual-project/charts/common/templates/_cronJob.yaml:XX:XX: executing "common.cronjob.tpl" at <.Values.value_a>: nil pointer evaluating interface ...
If, however, I run the following in
actual-project
, I get the correctly-filled-in result:
Copy code
helm dependency build .
helm template . -f ../common/values.yaml -f values.yaml -f actual-task/values.yaml
Pants version: 2.17 OS: Linux pantsbuild/pants