chart-testing icon indicating copy to clipboard operation
chart-testing copied to clipboard

during linting , the values.schema.json does not get enforced

Open RonaldCrb opened this issue 6 years ago • 2 comments

Is this a request for help?

Sort of...

Is this a BUG REPORT or FEATURE REQUEST?

More like a Feature question

Expected behaviour

when linting, the values should be validated against the values.schema.json file in a similar fashion than with the traditional helm cli.

[ERROR] templates/: values don't meet the specifications of the schema(s) in the following chart(s):
internship:
- envVars: ENV_VAR1 is required
- envVars: ENV_VAR2 is required
- envVars: ENV_VAR3 is required
- envVars: ENV_VAR4 is required
- envVars: ENV_VAR5 is required

Actual behaviour

the linting passes even when some of the values are missing. as if the values.schema.json was not present.

the context of execution

GitlabCI runner using the following docker image:

quay.io/helmpack/chart-testing:latest

this is the gitlab-ci.yml file

lint:
  stage: test
  image: quay.io/helmpack/chart-testing
  tags: ['k8s']
  script:
    - ct lint --config config.yaml
  except:
    - master

my config file looks like this:

# The name of the Git remote
remote: origin

# Chart directories separated by a space
chart-dirs:
  - charts/current
  # - charts/v3

# Charts that should be skipped
excluded_charts:
  - charts/deprecated

the actual output is this

No requirements found in charts/current/internship/charts.
130 Linting chart 'internship => (version: "2.0.0", path: "charts/current/internship")'
131 Checking chart 'internship => (version: "2.0.0", path: "charts/current/internship")' for a version bump...
132 Old chart version: 1.0.0
133 New chart version: 2.0.0
134 Chart version ok.
135 Validating /builds/<MASKED>/devops/helm/charts/current/internship/Chart.yaml...
136 Validation success! 👍
137 Validating maintainers...
138 ==> Linting charts/current/internship
139 [INFO] Chart.yaml: icon is recommended
140 1 chart(s) linted, no failures

RonaldCrb avatar Dec 10 '19 14:12 RonaldCrb

i think i found the problem, the image is still using helm v2.15

RonaldCrb avatar Dec 10 '19 15:12 RonaldCrb

after recompiling the code and building a docker image (using the code on the master branch) im getting a syntax error on the command:

ct lint --config config.yaml

this is the console output from the CI:

------------------------------------------------------------------------------------------------------------------------
331  Charts to be processed:
332 ------------------------------------------------------------------------------------------------------------------------
333  chart1 => (version: "2.0.0", path: "charts/current/chart1")
334  chart2 => (version: "2.0.0", path: "charts/current/chart2")
335  chart3 => (version: "2.0.0", path: "charts/current/chart3")
336 ------------------------------------------------------------------------------------------------------------------------
337 Linting chart 'chart1 => (version: "2.0.0", path: "charts/current/chart1")'
338 Checking chart 'chart1 => (version: "2.0.0", path: "charts/current/chart1")' for a version bump...
339 Old chart version: 1.0.0
340 New chart version: 2.0.0
341 Chart version ok.
342 Validating /builds/<MASKED>/devops/helm/charts/current/chart1/Chart.yaml...
343 Validation success! 👍
344 Validating maintainers...
345 Linting chart with values file 'charts/current/chart1/ci/test-values.yaml'...
346 ==> Linting charts/current/chart1
347 [INFO] Chart.yaml: icon is recommended
348 [ERROR] values.yaml: - envVars: ENV_VAR1 is required
349 - envVars: ENV_VAR2 is required
350 - envVars: ENV_VAR3 is required
351 - envVars: ENV_VAR4 is required
352 - envVars: ENV_VAR5 is required
353 Error: 1 chart(s) linted, 1 chart(s) failed
354 Linting chart 'chart2 => (version: "2.0.0", path: "charts/current/chart2")'
355 Checking chart 'chart2 => (version: "2.0.0", path: "charts/current/chart2")' for a version bump...
356 Old chart version: 1.0.0
357 New chart version: 2.0.0
358 Chart version ok.
359 Validating /builds/<MASKED>/devops/helm/charts/current/chart2/Chart.yaml...
360 Validation success! 👍
361 Validating maintainers...
362 Linting chart with values file 'charts/current/chart2/ci/test-values.yaml'...
363 ==> Linting charts/current/chart2
364 [INFO] Chart.yaml: icon is recommended
365 [ERROR] values.yaml: - envVars: ENV_VAR1 is required
366 - envVars: ENV_VAR2 is required
367 - envVars: ENV_VAR3 is required
368 - envVars: ENV_VAR4 is required
369 - envVars: ENV_VAR5 is required
370 Error: 1 chart(s) linted, 1 chart(s) failed
371 Linting chart 'chart3 => (version: "2.0.0", path: "charts/current/chart3")'
372 Checking chart 'chart3 => (version: "2.0.0", path: "charts/current/chart3")' for a version bump...
373 Old chart version: 1.0.0
374 New chart version: 2.0.0
375 Chart version ok.
376 Validating /builds/<MASKED>/devops/helm/charts/current/chart3/Chart.yaml...
377 Validation success! 👍
378 Validating maintainers...
379 ==> Linting charts/current/chart3
380 [INFO] Chart.yaml: icon is recommended
381 [ERROR] values.yaml: - envVars: ENV_VAR1 is required
382 - envVars: ENV_VAR2 is required
383 - envVars: ENV_VAR3 is required
384 - envVars: ENV_VAR4 is required
385 - envVars: ENV_VAR5 is required
386 [ERROR] templates/: values don't meet the specifications of the schema(s) in the following chart(s):
387 chart3:
388 - envVars: ENV_VAR1 is required
389 - envVars: ENV_VAR2 is required
390 - envVars: ENV_VAR3 is required
391 - envVars: ENV_VAR4 is required
392 - envVars: ENV_VAR5 is required
393 Error: Error linting charts: Error processing charts
394 Error: 1 chart(s) linted, 1 chart(s) failed
395 Error linting charts: Error processing charts
396 Usage:
397   ct lint [flags]
398 Flags:
399       --all                            Process all charts except those explicitly excluded.
400                                        Disables changed charts detection and version increment checking
401       --chart-dirs strings             Directories containing Helm charts. May be specified multiple times
402                                        or separate values with commas (default [charts])
403       --chart-repos strings            Additional chart repositories for dependency resolutions.
404                                        Repositories should be formatted as 'name=url' (ex: local=http://127.0.0.1:8879/charts).
405                                        May be specified multiple times or separate values with commas
406       --chart-yaml-schema string       The schema for chart.yml validation. If not specified, 'chart_schema.yaml'
407                                        is searched in the current directory, '$HOME/.ct', and '/etc/ct', in
408                                        that order.
409       --charts strings                 Specific charts to test. Disables changed charts detection and
410                                        version increment checking. May be specified multiple times
411                                        or separate values with commas
412       --check-version-increment        Activates a check for chart version increments (default: true) (default true)
413       --config string                  Config file
414       --debug                          Print CLI calls of external tools to stdout (Note: depending on helm-extra-args
415                                        passed, this may reveal sensitive data)
416       --excluded-charts strings        Charts that should be skipped. May be specified multiple times
417                                        or separate values with commas
418       --helm-repo-extra-args strings   Additional arguments for the 'helm repo add' command to be
419                                        specified on a per-repo basis with an equals sign as delimiter
420                                        (e.g. 'myrepo=--username test --password secret'). May be specified
421                                        multiple times or separate values with commas
422   -h, --help                           help for lint
423       --lint-conf string               The config file for YAML linting. If not specified, 'lintconf.yaml'
424                                        is searched in the current directory, '$HOME/.ct', and '/etc/ct', in
425                                        that order
426       --remote string                  The name of the Git remote used to identify changed charts (default "origin")
427       --target-branch string           The name of the target branch used to identify changed charts (default "master")
428       --validate-chart-schema          Enable schema validation of 'Chart.yaml' using Yamale (default: true) (default true)
429       --validate-maintainers           Enable validation of maintainer account names in chart.yml (default: true).
430                                        Works for GitHub, GitLab, and Bitbucket (default true)
431       --validate-yaml                  Enable linting of 'Chart.yaml' and values files (default: true) (default true)
432 ERROR: Job failed: command terminated with exit code 1

RonaldCrb avatar Dec 11 '19 13:12 RonaldCrb

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Dec 01 '23 01:12 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Dec 07 '23 01:12 github-actions[bot]