Added a new flag `--notes` to the `helm template`
command, with the default set to `false`.
If enabled, it will print the rendered `NOTES.txt`
at the end of the manifests.
If `--render-subchart-notes` (this flag already
exists on the `template` command, as it is
inherited from the `install` command) is also
enabled, the output will include the subcharts'
notes as well.
Updated the `install` command's
`--render-subchart-notes` flag description to
clarify that, in the case of the `template`
command, it is only valid when the `--notes` flag
is enabled.
Note: the `template` command uses most of the
`install` command's flags, including
`--render-subchart-notes`.
Updated `action.renderResources()` to format the
root chart's notes, and the subcharts' notes if
the `--render-subchart-notes` flag is enabled, and
return them as a string. The output depends on
whether it is:
- **Dry run**
- Notes are prefixed with the source filename
and separated with `---`.
- For `helm install` / `helm upgrade`, the
`--dry-run` flag enables this behavior.
- The `helm template` command is considered a
dry run by default.
- Example:
```
foo NOTES HERE
bar NOTES HERE
baz NOTES HERE
qux NOTES HERE
```
- **Not a dry run**
- Only the root chart's notes are rendered by
default.
- If the `--render-subchart-notes` flag is
enabled, the subcharts' notes are also
included.
- Each note is prefixed with the source filename
and separated with `---`.
- Example:
```
---
# Source: foo/templates/NOTES.txt
foo NOTES HERE
---
# Source: foo/charts/bar/templates/NOTES.txt
bar NOTES HERE
---
# Source: foo/charts/baz/templates/NOTES.txt
baz NOTES HERE
---
# Source: foo/charts/bar/charts/qux/templates/NOTES.txt
qux NOTES HERE
```
In both cases, the notes are sorted based on the
following conditions:
1. Depth
2. Alphabetical order (since the notes file name
is always the same, the sorting applies to the
chart/subchart name).
Added tests for the following scenarios:
- helm template:
1. On the chart without notes or subcharts
2. `--notes` on chart without notes or
subcharts
3. `--render-subchart-notes` on chart without
notes or subcharts
4. `--notes --render-subchart-notes` on chart
without notes or subcharts
5. On the chart with notes without subcharts
6. `--notes` on chart with notes without
subcharts
7. `--render-subchart-notes` on chart with
notes without subcharts
8. `--notes --render-subchart-notes` on chart
with notes without subcharts
9. On the chart with notes and subchart
10. `--notes` on chart with notes and subchart
11. `--render-subchart-notes` on the chart with
notes and subchart
12. `--notes --render-subchart-notes` on chart
with notes and subchart
13. `--help`
- helm install:
1. On the chart without notes or subcharts
2. `--dry-run` on chart without notes or
subcharts
3. `--render-subchart-notes` on chart without
notes or subcharts
4. `--dry-run --render-subchart-notes` on chart
without notes or subcharts
5. On the chart with notes without subcharts
6. `--dry-run` on chart with notes without
subcharts
7. `--render-subchart-notes` on chart with
notes without subcharts
8. `--dry-run --render-subchart-notes` on chart
with notes without subcharts
9. On a chart with notes and subcharts
10. `--dry-run` on chart with notes and
subcharts
11. `--render-subchart-notes` on chart with
notes and subcharts
12. `--dry-run --render-subchart-notes` on
chart with notes and subcharts
13. `--help`
- helm upgrade:
1. On the chart without notes or subcharts
2. `--dry-run` on chart without notes or
subcharts
3. `--render-subchart-notes` on chart without
notes or subcharts
4. `--dry-run --render-subchart-notes` on chart
without notes or subcharts
5. On the chart with notes without subcharts
6. `--dry-run` on chart with notes without
subcharts
7. `--render-subchart-notes` on chart with
notes without subcharts
8. `--dry-run --render-subchart-notes` on chart
with notes without subcharts
9. On the chart with notes and subcharts
10. `--dry-run` on chart with notes and
subcharts
11. `--render-subchart-notes` on chart with
notes and subcharts
12. `--dry-run --render-subchart-notes` on
chart with notes and subcharts
13. `--help`
Closes#6901
Signed-off-by: Bhargav Ravuri <bhargav.ravuri@infracloud.io>
Building the same chart into an archive multiple times will have
the same sha256 hash.
Perviously, the time in the headers for a file was time.Now() which
changed each time. The time is now collected from the operating
system when the file is loaded and this time is used.
Fixes: #3612
Signed-off-by: Matt Farina <matt.farina@suse.com>
This change is about handling the interfaces to public functions for
different chart apiVersions. The internals are still focused on v2.
This enables v3 to be layered in layer.
Signed-off-by: Matt Farina <matt.farina@suse.com>
Close: #31231
```
Error: cmd/helm/root.go:165:2: SA1019: flags.ParseErrorsWhitelist is deprecated: use [FlagSet.ParseErrorsAllowlist] instead. This field will be removed in a future release. (staticcheck)
```
Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
Linting is specific to the chart versions. A v2 and v3 chart will
lint differently.
To accomplish this, packages like engine need to be able to handle
different chart versions. This was accomplished by some changes:
1. The introduction of a Charter interface for charts
2. The ChartAccessor which is able to accept a chart and then
provide access to its data via an interface. There is an
interface, factory, and implementation for each version of
chart.
3. Common packages were moved to a common and util packages.
Due to some package loops, there are 2 packages which may
get some consolidation in the future.
The new interfaces provide the foundation to move the actions
and cmd packages to be able to handle multiple apiVersions of
charts.
Signed-off-by: Matt Farina <matt.farina@suse.com>
The repo package is internally versioned at v1. Repos were designed
to be versioned. This change moves it to a versioned directory the
same way other packages are now being handled.
Signed-off-by: Matt Farina <matt.farina@suse.com>