-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Danilo Patrucco <[email protected]> Signed-off-by: danilo-patrucco <[email protected]> Signed-off-by: Danilo Patrucco <[email protected]> Signed-off-by: Danilo Patrucco <[email protected]>
- Loading branch information
1 parent
36ac1d9
commit 1385741
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
hip: 0019 | ||
title: "Add Exclude File Option to Helm Lint Command" | ||
authors: Danilo Patrucco | ||
created: "2024-07-03" | ||
type: "feature" | ||
status: "draft" | ||
--- | ||
|
||
## Abstract | ||
This proposal suggests enhancing the `helm lint` command to exclude specific files or patterns from linting through a `.helmlintignore` file, similar to `.gitignore` or `.helmignore`. Additionally, a `--lint-ignore-file` flag will be introduced to specify alternative locations for the `.helmlintignore` file, facilitating its use in projects with multiple sub-charts. | ||
## Motivation | ||
In large Helm charts, certain files or configurations may deviate from standard linting rules but are accepted by the maintainers. Currently, `helm lint` evaluates all files within a chart, leading to irrelevant warnings or errors. An exclusion option and the ability to specify ignore file locations would allow developers to better manage lint results. | ||
## Rationale | ||
This proposal aims to give developers and integrators greater control over the linting process by allowing exclusions for: | ||
- Files imported or managed by third parties that are not directly editable. | ||
- Files that may not conform to static linting rules. | ||
- Files containing intentional deviations from standard practices due to specific deployment scenarios. | ||
The `.helmlintignore` file will support simple patterns to match files and directories for easy exclusion management. The `--lint-ignore-file` flag enhances this by allowing centralized management of lint exclusions in complex projects. | ||
## Specification | ||
### `.helmlintignore` File Format | ||
The `.helmlintignore` file allows chart developers to specify filenames or glob patterns to exclude from linting. The format is straightforward, with one pattern per line, similar to `.gitignore` files. | ||
#### Example | ||
``` | ||
# .helmlintignore file example | ||
template/test/test.sh # Exclude this file from linting | ||
template/test/test.yaml {{template "fullname" .}} # Exclude this specific line from findings in this specific file (error is still detected but no output is generated) | ||
``` | ||
Patterns can be a simple `path/to/my/file` to exclude a whole file, or `path/to/my/file line.triggering.error` to ignore specific error-triggering lines in the error output. | ||
### Command Behavior | ||
When `helm lint` is executed, it will first check for the presence of a `.helmlintignore` file in the chart directory or at a specified location using the `--lint-ignore-file` flag. This allows the command to parse the file and exclude any files or directories matching the patterns. Additionally, if a file contains a specific error line that matches a pattern, that error will not be displayed. | ||
## Backwards Compatibility | ||
This proposal introduces no breaking changes. Charts without a `.helmlintignore` file or without using the `--lint-ignore-file` flag will function as they currently do. | ||
## Security Implications | ||
No significant security implications are expected. The `.helmlintignore` file is processed locally by `helm lint` without modifying chart content or involving network activity. | ||
## How to Teach This | ||
Documentation for the `.helmlintignore` file and the `--lint-ignore-file` flag will be included in the official Helm docs under the `helm lint` section. Examples and common patterns will be provided to aid new users. | ||
## Reference Implementation | ||
No reference implementation yet. Post-acceptance, an issue will be created in the Helm community GitHub repository to add the HIP | ||
## Open Issues | ||
- Finalizing an effective and user-friendly pattern syntax for the `.helmlintignore` file. | ||
- Potential inclusion of in-file annotations for temporarily excluding specific chart sections from linting. | ||
## Rejected Ideas | ||
None at this time. | ||
## References | ||
- This proposal is in line with the practices outlined in [HIP-0001](https://github.com/helm/community/blob/master/hips/hip-0001.md). |