Skip to content

Commit 63d870f

Browse files
committed
docs: align Helm lifecycle review details
1 parent fec8503 commit 63d870f

4 files changed

Lines changed: 52 additions & 118 deletions

File tree

internal/exec/describe_affected_components_test.go

Lines changed: 37 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ func TestProcessHelmComponentsIndexed_FolderChanged(t *testing.T) {
612612
assert.Contains(t, affected[0].AffectedAll, affectedReasonComponent)
613613
}
614614

615-
func TestProcessHelmComponentsIndexed_ValuesFileChangedOutsideComponentBasePath(t *testing.T) {
615+
func TestProcessHelmComponentsIndexed_ValuesFilesChanged(t *testing.T) {
616616
tempDir := t.TempDir()
617617
atmosConfig := helmAtmosConfig()
618618
atmosConfig.BasePath = tempDir
@@ -623,109 +623,45 @@ func TestProcessHelmComponentsIndexed_ValuesFileChangedOutsideComponentBasePath(
623623
valuesRef, err := filepath.Rel(componentPath, valuesFile)
624624
require.NoError(t, err)
625625

626-
identical := map[string]any{
627-
cfg.ComponentSectionName: componentFolder,
628-
sectionNameChart: ".",
629-
sectionNameValuesF: []any{valuesRef},
630-
}
631-
helmSection := map[string]any{helmTestComponent: identical}
632-
remoteStacks := helmRemoteStacksWith(identical)
633-
filesIndex := newChangedFilesIndex(atmosConfig, []string{valuesFile}, tempDir)
634-
635-
affected, err := processHelmComponentsIndexed(
636-
helmTestStack, helmSection, &remoteStacks, &remoteStacks,
637-
atmosConfig, filesIndex, newComponentPathPatternCache(),
638-
false, false, false,
639-
)
640-
require.NoError(t, err)
641-
642-
require.Len(t, affected, 1)
643-
assert.Equal(t, helmTestComponent, affected[0].Component)
644-
assert.Equal(t, cfg.HelmComponentType, affected[0].ComponentType)
645-
assert.Contains(t, affected[0].AffectedAll, affectedReasonStackValuesFile)
646-
}
647-
648-
func TestProcessHelmComponentsIndexed_ScalarValuesFileChanged(t *testing.T) {
649-
tempDir := t.TempDir()
650-
atmosConfig := helmAtmosConfig()
651-
atmosConfig.BasePath = tempDir
652-
653-
componentFolder := "shared-chart"
654-
componentPath := filepath.Join(tempDir, "components", "helm", componentFolder)
655-
valuesFile := filepath.Join(tempDir, "config", "helm", "app-values.yaml")
656-
valuesRef, err := filepath.Rel(componentPath, valuesFile)
657-
require.NoError(t, err)
658-
659-
identical := map[string]any{
660-
cfg.ComponentSectionName: componentFolder,
661-
sectionNameChart: ".",
662-
sectionNameValuesF: valuesRef,
663-
}
664-
helmSection := map[string]any{helmTestComponent: identical}
665-
remoteStacks := helmRemoteStacksWith(identical)
666-
filesIndex := newChangedFilesIndex(atmosConfig, []string{valuesFile}, tempDir)
667-
668-
affected, err := processHelmComponentsIndexed(
669-
helmTestStack, helmSection, &remoteStacks, &remoteStacks,
670-
atmosConfig, filesIndex, newComponentPathPatternCache(),
671-
false, false, false,
672-
)
673-
require.NoError(t, err)
674-
675-
require.Len(t, affected, 1)
676-
assert.Equal(t, helmTestComponent, affected[0].Component)
677-
assert.Equal(t, cfg.HelmComponentType, affected[0].ComponentType)
678-
assert.Contains(t, affected[0].AffectedAll, affectedReasonStackValuesFile)
679-
}
680-
681-
func TestProcessHelmComponentsIndexed_AbsoluteValuesFileChanged(t *testing.T) {
682-
tempDir := t.TempDir()
683-
atmosConfig := helmAtmosConfig()
684-
atmosConfig.BasePath = tempDir
685-
686-
valuesFile := filepath.Join(tempDir, "config", "helm", "app-values.yaml")
687-
identical := map[string]any{
688-
cfg.ComponentSectionName: "shared-chart",
689-
sectionNameChart: ".",
690-
sectionNameValuesF: []any{valuesFile},
691-
}
692-
helmSection := map[string]any{helmTestComponent: identical}
693-
remoteStacks := helmRemoteStacksWith(identical)
694-
filesIndex := newChangedFilesIndex(atmosConfig, []string{valuesFile}, tempDir)
695-
696-
affected, err := processHelmComponentsIndexed(
697-
helmTestStack, helmSection, &remoteStacks, &remoteStacks,
698-
atmosConfig, filesIndex, newComponentPathPatternCache(),
699-
false, false, false,
700-
)
701-
require.NoError(t, err)
702-
703-
require.Len(t, affected, 1)
704-
assert.Equal(t, helmTestComponent, affected[0].Component)
705-
assert.Equal(t, cfg.HelmComponentType, affected[0].ComponentType)
706-
assert.Contains(t, affected[0].AffectedAll, affectedReasonStackValuesFile)
707-
}
626+
for _, tt := range []struct {
627+
name string
628+
valuesFiles any
629+
changedFile string
630+
wantAffected bool
631+
}{
632+
{name: "relative list", valuesFiles: []any{valuesRef}, changedFile: valuesFile, wantAffected: true},
633+
{name: "scalar", valuesFiles: valuesRef, changedFile: valuesFile, wantAffected: true},
634+
{name: "absolute", valuesFiles: []any{valuesFile}, changedFile: valuesFile, wantAffected: true},
635+
{name: "unrelated", valuesFiles: []string{valuesRef}, changedFile: filepath.Join(tempDir, "config", "helm", "other-values.yaml")},
636+
} {
637+
t.Run(tt.name, func(t *testing.T) {
638+
identical := map[string]any{
639+
cfg.ComponentSectionName: componentFolder,
640+
sectionNameChart: ".",
641+
sectionNameValuesF: tt.valuesFiles,
642+
}
643+
helmSection := map[string]any{helmTestComponent: identical}
644+
remoteStacks := helmRemoteStacksWith(identical)
645+
filesIndex := newChangedFilesIndex(atmosConfig, []string{tt.changedFile}, tempDir)
646+
647+
affected, err := processHelmComponentsIndexed(
648+
helmTestStack, helmSection, &remoteStacks, &remoteStacks,
649+
atmosConfig, filesIndex, newComponentPathPatternCache(),
650+
false, false, false,
651+
)
652+
require.NoError(t, err)
708653

709-
func TestProcessHelmComponentsIndexed_UnrelatedFileDoesNotAffectValuesFile(t *testing.T) {
710-
tempDir := t.TempDir()
711-
atmosConfig := helmAtmosConfig()
712-
atmosConfig.BasePath = tempDir
654+
if !tt.wantAffected {
655+
assert.Empty(t, affected)
656+
return
657+
}
713658

714-
identical := map[string]any{
715-
sectionNameChart: ".",
716-
sectionNameValuesF: []string{"../../../config/helm/app-values.yaml"},
659+
require.Len(t, affected, 1)
660+
assert.Equal(t, helmTestComponent, affected[0].Component)
661+
assert.Equal(t, cfg.HelmComponentType, affected[0].ComponentType)
662+
assert.Contains(t, affected[0].AffectedAll, affectedReasonStackValuesFile)
663+
})
717664
}
718-
helmSection := map[string]any{helmTestComponent: identical}
719-
remoteStacks := helmRemoteStacksWith(identical)
720-
filesIndex := newChangedFilesIndex(atmosConfig, []string{filepath.Join(tempDir, "config", "helm", "other-values.yaml")}, tempDir)
721-
722-
affected, err := processHelmComponentsIndexed(
723-
helmTestStack, helmSection, &remoteStacks, &remoteStacks,
724-
atmosConfig, filesIndex, newComponentPathPatternCache(),
725-
false, false, false,
726-
)
727-
require.NoError(t, err)
728-
assert.Empty(t, affected)
729665
}
730666

731667
func TestProcessHelmComponentsIndexed_SkipsAbstractLockedAndInvalidSections(t *testing.T) {

pkg/ci/plugins/helm/plugin_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,9 @@ func TestTemplateRendering(t *testing.T) {
270270
"| Timeout | `30m0s` |",
271271
"| Chart hooks enabled | `true` |",
272272
"| Wait for Jobs | `true` |",
273-
"| On failure | `rollback` |",
274-
"| Cleanup on failure | `true` |",
275-
"| Maximum history | `10` |",
273+
"| On failure | `rollback` |\n" +
274+
"| Cleanup on failure | `true` |\n" +
275+
"| Maximum history | `10` |",
276276
},
277277
},
278278
{
@@ -293,8 +293,8 @@ func TestTemplateRendering(t *testing.T) {
293293
"| Timeout | `5m0s` |",
294294
"| Chart hooks enabled | `true` |",
295295
"| Wait for Jobs | `false` |",
296-
"| On failure | `keep` |",
297-
"| Install CRDs | `create` |",
296+
"| On failure | `keep` |\n" +
297+
"| Install CRDs | `create` |",
298298
},
299299
notContains: []string{"Maximum history"},
300300
},

pkg/ci/plugins/helm/templates/apply.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,12 @@
3636
| Chart hooks enabled | `{{ index . "chart_hooks" }}` |
3737
| Wait for Jobs | `{{ index (index . "wait") "jobs" }}` |
3838
| On failure | `{{ index . "on_failure" }}` |
39-
40-
{{ if eq (index . "operation") "install" }}
39+
{{ if eq (index . "operation") "install" -}}
4140
| Install CRDs | `{{ index . "crds" }}` |
42-
43-
{{ end }}
44-
45-
{{ if eq (index . "operation") "upgrade" }}
41+
{{ end -}}
42+
{{ if eq (index . "operation") "upgrade" -}}
4643
| Cleanup on failure | `{{ index . "cleanup_on_failure" }}` |
4744
| Maximum history | `{{ index (index . "history") "max" }}` |
48-
4945
{{ end }}
5046

5147
{{ end }}

website/docs/cli/configuration/components/helm.mdx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,13 @@ components:
5555
</dl>
5656

5757
:::info Release policy belongs in stacks
58-
Helm 4 lifecycle fields such as `wait_strategy`, `timeout`,
59-
`on_failure`, and `max_history` are stack configuration, not
60-
project-wide `components.helm` settings in `atmos.yaml`. This keeps release
61-
policy subject to stack imports, component inheritance, and environment-specific
62-
overrides. See [Helm stack configuration](/stacks/components/helm#release-lifecycle).
58+
Helm 4 lifecycle fields such as `release.wait.strategy`, `release.wait.jobs`,
59+
`release.timeout`, `release.history.max`, and operation-specific
60+
`release.install.on_failure` or `release.upgrade.on_failure` are stack
61+
configuration, not project-wide `components.helm` settings in `atmos.yaml`.
62+
This keeps release policy subject to stack imports, component inheritance, and
63+
environment-specific overrides. See
64+
[Helm stack configuration](/stacks/components/helm#release-lifecycle).
6365
:::
6466

6567
## Helm Repositories

0 commit comments

Comments
 (0)