Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always write the update output file, even on container failure #376

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions internal/infra/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,15 @@ func Run(params RunParams) error {
if params.ApiUrl == "" {
params.ApiUrl = fmt.Sprintf("http://host.docker.internal:%v", api.Port())
}
if err := runContainers(ctx, params); err != nil {
return err
}

// run the containers, but don't return the error until AFTER the output is generated.
// this ensures that the output is always written in the scenario where there are multiple outputs,
// some that succeed and some that fail; we still want to see the output of the successful ones.
runContainersErr := runContainers(ctx, params)

api.Complete()

// write the output to a file
output, err := generateOutput(params, api, outFile)
if err != nil {
return err
Expand All @@ -146,7 +149,7 @@ func Run(params RunParams) error {
return diff(params, outFile, output)
}

return nil
return runContainersErr
}

func generateOutput(params RunParams, api *server.API, outFile *os.File) ([]byte, error) {
Expand Down