Fix Windows container exit code handling and error checks (#6411)

This commit is contained in:
Uğur Tafralı
2026-04-09 06:07:22 +03:00
committed by GitHub
parent 0dfb08b635
commit f2abd692e9

View File

@@ -279,8 +279,12 @@ func (e *docker) WaitStep(ctx context.Context, step *backend_types.Step, taskUUI
select {
case resp := <-wait.Result:
log.Trace().Msgf("ContainerWait returned with resp: %v", resp)
if resp.Error != nil {
return nil, fmt.Errorf("ContainerWait error: %s", resp.Error.Message)
}
case err := <-wait.Error:
log.Trace().Msgf("ContainerWait returned with err: %v", err)
return nil, err
case <-ctx.Done():
return nil, ctx.Err()
}
@@ -290,9 +294,15 @@ func (e *docker) WaitStep(ctx context.Context, step *backend_types.Step, taskUUI
return nil, err
}
exitCode := info.Container.State.ExitCode
// Windows Docker may return 4294967295 (uint32 max, i.e. int32(-1)) for abnormal exits.
if exitCode == int(^uint32(0)) {
exitCode = int(int32(exitCode))
}
return &backend_types.State{
Exited: true,
ExitCode: info.Container.State.ExitCode,
ExitCode: exitCode,
OOMKilled: info.Container.State.OOMKilled,
}, nil
}