-
Notifications
You must be signed in to change notification settings - Fork 202
HIP: Add Exclude File Option to Helm Lint Command #353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
1385741
b8e3b42
168c2e5
00809c1
23e2488
534e367
4e07227
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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, Daniel Pritchett | ||
| 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. | ||
danilo-patrucco marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ## 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 | ||
danilo-patrucco marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ### `.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 | ||
danilo-patrucco marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ## 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). | ||
Uh oh!
There was an error while loading. Please reload this page.