Skip to content

Commit

Permalink
WIP: magically write output of "namespaced" steps to namespace
Browse files Browse the repository at this point in the history
Signed-off-by: Hidde Beydals <[email protected]>
  • Loading branch information
hiddeco committed Dec 16, 2024
1 parent 4fc9dc0 commit c2c5b14
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion internal/directives/simple_engine_promote.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,21 @@ func (e *SimpleEngine) executeSteps(
stepExecMeta.Status = result.Status
stepExecMeta.Message = result.Message
}
state[step.Alias] = result.Output

// TODO(hidde): until we have a better way to handle the output of steps
// inflated from tasks, we need to apply a special treatment to the output
// to allow it to become available under the alias of the "task".
aliasNamespace := getAliasNamespace(step.Alias)
if aliasNamespace != "" && reg.Runner.Name() == (&outputComposer{}).Name() {
if state[aliasNamespace] == nil {
state[aliasNamespace] = make(State)
}
for k, v := range result.Output {
state[aliasNamespace].(State)[k] = v // nolint: forcetypeassert
}

Check warning on line 134 in internal/directives/simple_engine_promote.go

View check run for this annotation

Codecov / codecov/patch

internal/directives/simple_engine_promote.go#L129-L134

Added lines #L129 - L134 were not covered by tests
} else {
state[step.Alias] = result.Output
}

if stepExecMeta.Status == kargoapi.PromotionPhaseSucceeded {
stepExecMeta.FinishedAt = ptr.To(metav1.Now())
Expand Down

0 comments on commit c2c5b14

Please sign in to comment.