* fix: add new static linter and fix issues it found
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
* fixed two additional linter errors.
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
Fixes#5733
This adds two specific checks. A warning if a chart has a `crd-install` hook
and an error if the chart contains `.Release.Time`. Further checks can be added
down the road as needed using the same pattern I use here
Signed-off-by: Taylor Thomas <taylor.thomas@microsoft.com>
* Kubernetes updated to 1.16.1
* SemVer and Sprig updated to latest releases that leverage go
modules
* Tests and checks updated. These already landed in v2 via PR 6457
Signed-off-by: Matt Farina <matt@mattfarina.com>
This commit replaces usage of github.com/ghodss/yaml with it's forked
version maintained by SIG community. The replaced library has
low-to-none support activity unlike the latter. We believe the new
Helm branch could benefit from using the community-supported version on
a long-term run as yaml parser is a key component of Helm chart rendering
engine.
This commit locks sigs.k8s.io/yaml dependency version on 1.1.0 which
is backwards compatible with ghodss/yaml 1.0.0.
This change also resolves the outdated dependency version lock for
ghodss/yaml (currently 1.0.0) and makes it possible to port changes from
https://github.com/helm/helm/pull/6010 to dev-v3.
Signed-off-by: Oleg Sidorov <oleg.sidorov@booking.com>
Have updated the required filter so that it doesn't break when linting a
chart. This work is based off #4221 and #4748 which didn't make it into
the v3 branch.
Signed-off-by: Thomas O'Donnell <andy.tom@gmail.com>
* Add the Schema type and a function to read it
* Added a function to read a schema from a file
* Check that values.yaml matches schema
This commit uses the gojsonschema package to validate a values.yaml file
against a corresponding values.schema.yaml file.
* Add functionality to generate a schema from a values.yaml
* Add Schema to Chart and loader
* Clean up implementation in chartutil
* Add tests for helm install with schema
* Add schema validation to helm lint
* Clean up "matchSchema"
* Modify error output
* Add documentation
* Fix a linter issue
* Fix a test that broke during a rebase
* Clean up documentation
* Specify JSONSchema spec
Since JSONSchema is still in a draft state as of this commit, we need to
specify a particular version of the JSONSchema spec
* Switch to using builtin functionality for file extensions
* Switch to using a third-party library for JSON conversion
* Use the constants from the gojsonschema package
* Updates to unit tests
* Minor change to avoid string cast
* Remove JSON Schema generation
* Change Schema type from map[string]interface{} to []byte
* Convert all Schema YAML to JSON
* Fix some tests that were broken by a rebase
* Fix up YAML/JSON conversions
* This checks subcharts for schema validation
The final coalesced values for a given chart will be validated against
that chart's schema, as well as any dependent subchart's schema
* Add unit tests for ValidateAgainstSchema
* Remove nonessential test files
* Remove a misleading unit test
The TestReadSchema unit test was simply testing the ReadValues function,
which is already being validated in the TestReadValues unit test
* Update documentation to reflect changes to subchart schemas
Make template specific functions private to ensure they not misused and
make unit tests simpler. We may export the template helpers later if
needed.
This lays the foundation for the new chart pipeline.
Signed-off-by: Adam Reese <adam@reese.io>
* Remove helmVersion constraint from charts
* Guard compile time set variables behind `internal/`
* Allow configuration of UserAgent for HTTPGetter
Signed-off-by: Adam Reese <adam@reese.io>
* Add "--namespace" to helm lint
Keep lint syntax as close as possible to "helm install" resp. "helm
upgrade", so that one only needs to change the command.
See #2036
* Align lintCmd struct
* Add "--set" and "--values" to helm lint
Keep lint syntax as close as possible to "helm install" resp. "helm
upgrade", so that one only needs to change the command.
Closes #2495,#2036
* Reuse strict parameter, when rendering during lint
We want to see the rendering fail, if we missed a value, so we reuse
"--strict".
See #2495,#2036
* Fix lint unit test
See #2495,#2036
* Update docs
Each maintainer can have an optional URL. There are seceral use
cases for providing a URL instead of an email address:
- The case where a maintainer wants to hide their email address
behind a webform for personal security
- When the maintainer is an organization and feedback should
go to an issue queue
This change:
- Adds the proto field for url
- Updates the generated files for the chart proto
- Includes linting for the url
- Updates the docs to include the url
Closes#3056
since kubernetes 1.4, the upper limit for resource name is 63 characters,
so it is better to change the template when running `helm create` accordingly.
This adds the {{.Capabilities}} object to the template variables so that
chart authors can write charts that are aware of teh Kubernetes
capabilities of the current cluster.
Closes#1608
Long ago, Helm did not support cross-namespace installs. There was a
linter rule to catch this. When we changed the way Helm worked, we did
not remove the linter rule. This commit removes that linter rule.
Closes#1489
This adds a function engine.FuncMap that returns a function mapping that
better represents the functions passed to a template. The linting logic
is reconfigured to use this function instead of the sprig.FuncMap
function.
Closes#1366
The YAML validation was broken because the renderedContentMap has keys
with the path to the template including the chart directory, whereas the
linter was trying to access it relative from the chart directory.
For example, the hash key was `drupal/templates/deployment.yaml` but the
linter was trying to access `templates/deployment.yaml`. This commit
fixes the key used to access the rendered content.
Handle a previously unhandled error in the linter. This simply bails out
if a chart's values files do not parse.
Also, changed the implementation of CoalesceValues to return a map even
on error.
Template rules
Adding chart errors
Added function that checks the existence of all the values in the templates
Adding chartfile unit tests
Testing runLinterRule
Fixing out of range
Fixing out of range
Improving quote detector
Fixed tests
Adding chart name linter
Add lint error
Moving to blocks
Moving to method
Moved lint rules to functions
Semantic version validation
Linting engine
Adding sources and home validations
Sharing file loading
Sharing file loading
Rolling back readme
Rewriting other linters
Fixing tests
Typo
Using chart.Metadata
Fixing format
Adding UNKNOWN in Engine
Adding tabs
Fixing tabs