Skip to content

Commit

Permalink
fix(ui): corretly set step file number prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
Zebradil committed Sep 22, 2023
1 parent b7dd45a commit f58d689
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/myks/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (a *Application) Render(yamlTemplatingTools []YamlTemplatingTool) (string,
log.Debug().Msg(a.Msg(renderStepName, "Starting"))
outputYaml := ""
lastStepOutputFile := ""
for _, yamlTool := range yamlTemplatingTools {
for nr, yamlTool := range yamlTemplatingTools {
log.Debug().Msg(a.Msg(yamlTool.Ident(), "Starting"))
stepOutputYaml, err := yamlTool.Render(lastStepOutputFile)
if err != nil {
Expand All @@ -48,7 +48,7 @@ func (a *Application) Render(yamlTemplatingTools []YamlTemplatingTool) (string,
} else {
outputYaml = stepOutputYaml
}
lastStepOutputFile, err = a.storeStepResult(outputYaml, yamlTool.Ident(), 1)
lastStepOutputFile, err = a.storeStepResult(outputYaml, yamlTool.Ident(), nr)
if err != nil {
log.Error().Err(err).Msg(a.Msg(yamlTool.Ident(), "Failed to store step result for: "+yamlTool.Ident()))
return "", err
Expand Down Expand Up @@ -124,7 +124,7 @@ func (a *Application) runSliceFormatStore(previousStepFile string) error {

// storeStepResult saves output of a step to a file in the application's temp directory.
// Returns path to the file or an error.
func (a *Application) storeStepResult(output string, stepName string, stepNumber uint) (string, error) {
func (a *Application) storeStepResult(output string, stepName string, stepNumber int) (string, error) {
fileName := filepath.Join("steps", fmt.Sprintf("%02d-%s.yaml", stepNumber, stepName))
file := a.expandTempPath(fileName)
return file, a.writeTempFile(fileName, output)
Expand Down

0 comments on commit f58d689

Please sign in to comment.