* Return correct exit code when using values files
The return values from the individual calls to `lint_chart_with_single_config`
are masked by the other operations in the `lint_chart_with_all_configs`
function.
When `helm lint` reports an error to STDERR but the chart is incorrectly
given a success tick and the exit code of `chart_test.sh` is 0 for
success. An example using `quay.io/helmpack/chart-testing:v1.1.0`:
==> Linting charts/nomad-server
[ERROR] templates/: render error in "nomad-server/templates/nomad-server.yaml": template: nomad-server/templates/nomad-server.yaml:55:28: executing "nomad-server/templates/nomad-server.yaml" at <{{template "fullname...>: template "fullname" not defined
Error: 1 chart(s) linted, 1 chart(s) failed
--------------------------------------------------------------------------------
✔︎ charts/nomad-server
--------------------------------------------------------------------------------
dcarley@cci-mbp ~/p/g/s/g/c/circle-external-services-chart master echo $?
0s
Fix this by copying the pattern used in other functions of tracking
failures in a local boolean variable and using that to determine the
return code at the end of the function. This is the result after:
==> Linting charts/nomad-server
[ERROR] templates/: render error in "nomad-server/templates/nomad-server.yaml": template: nomad-server/templates/nomad-server.yaml:55:28: executing "nomad-server/templates/nomad-server.yaml" at <{{template "fullname...>: template "fullname" not defined
Error: 1 chart(s) linted, 1 chart(s) failed
--------------------------------------------------------------------------------
✖︎ charts/nomad-server
--------------------------------------------------------------------------------
✘ dcarley@cci-mbp ~/p/g/s/g/c/circle-external-services-chart master echo $?
1
There are probably other bugs like this. Shell scripting does not
provide safe error handling for these cases and it's difficult to write
unit tests for. This is another good reason why the proposal in #29 to
re-implement in another language is a good idea.
Signed-off-by: Dan Carley <dan.carley@gmail.com>
* Make error handling for functions consistent
The `|| error=true` pattern is already used in a few other places. This
makes the change from 64c1e52 consistent with the others.
Signed-off-by: Dan Carley <dan.carley@gmail.com>
The use case for this is an environment where every change is not
a new release of a chart. When new releases are created the
increment can be checked while development outside a release
does not need to check for it
Signed-off-by: Matt Farina <matt@mattfarina.com>
* [WIP] Factor out testing code from charts
* Minor various fixes
Please enter the commit message for your changes. Lines starting
* Start readme
* Update readme and add GKE example
* Add CircleCI job for ShellCheck
* Install Helm and kubectl after other tools
Also: Hard-code version for kubectl.
* Fix readme
* Update maintainer validation
'chartlib::validate_maintainers' should not log an error if there's no maintainers
section. This is already covered by the schema validation.
* Add random suffix to namespaces
* Improve container logs output
* Improve logging
* Add --cleanup flag to 'helm test'
* Improve namespace cleanup
* Improve logging
* Add random suffixes to releases
* Update logging and Docker image version
* Update GKE example
* Fix Bash array declarations
* Remove user from Docker image
* Add summary
* Use kubectl rollout status for deployments
* Add some more fixes
* Build dependencies before linting
* Fix array initialization
* Increase sleep time for namespace polling
* Add missing colon
* Create v1.0.0
* Update Helm to v2.9.1
* Add missing local keywords
* Bump image version
* Update copyright headers