Skip to content

Commit c87cd51

Browse files
ohaibbqaknysh
andauthored
Update stack after parsing name template in describe_stacks (#1226)
* Update `stack` after parsing name template in `describe_stacks` * add some light coverage to helmfile branch --------- Co-authored-by: Andriy Knysh <[email protected]>
1 parent 150687a commit c87cd51

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

internal/exec/describe_stacks.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ func ExecuteDescribeStacks(
347347
}
348348

349349
// Atmos component, stack, and stack manifest file
350+
configAndStacksInfo.Stack = stackName
350351
componentSection["atmos_component"] = componentName
351352
componentSection["atmos_stack"] = stackName
352353
componentSection["stack"] = stackName
@@ -539,6 +540,7 @@ func ExecuteDescribeStacks(
539540
finalStacksMap[stackName] = make(map[string]any)
540541
}
541542

543+
configAndStacksInfo.Stack = stackName
542544
configAndStacksInfo.ComponentSection["atmos_component"] = componentName
543545
configAndStacksInfo.ComponentSection["atmos_stack"] = stackName
544546
configAndStacksInfo.ComponentSection["stack"] = stackName

pkg/describe/describe_stacks_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,23 @@ func TestDescribeStacksWithFilter7(t *testing.T) {
176176
t.Log(stacksYaml)
177177
}
178178

179+
func TestDescribeStacksWithFilter8(t *testing.T) {
180+
configAndStacksInfo := schema.ConfigAndStacksInfo{}
181+
182+
atmosConfig, err := cfg.InitCliConfig(configAndStacksInfo, true)
183+
assert.Nil(t, err)
184+
185+
componentTypes := []string{"helmfile"}
186+
sections := []string{"none"}
187+
188+
stacks, err := ExecuteDescribeStacks(atmosConfig, "", nil, componentTypes, sections, false, false)
189+
assert.Nil(t, err)
190+
191+
dependentsYaml, err := u.ConvertToYAML(stacks)
192+
assert.Nil(t, err)
193+
t.Log(dependentsYaml)
194+
}
195+
179196
func TestDescribeStacksWithEmptyStacks(t *testing.T) {
180197
configAndStacksInfo := schema.ConfigAndStacksInfo{}
181198

0 commit comments

Comments
 (0)