buildkit: support concurrent starts

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2021-04-15 01:15:01 -07:00
parent 23d6a8800b
commit 3f9103c8aa

View File

@ -116,6 +116,10 @@ func startBuildkit(ctx context.Context) error {
) )
output, err = cmd.CombinedOutput() output, err = cmd.CombinedOutput()
if err != nil { if err != nil {
// If the daemon failed to start because it's already running,
// chances are another dagger instance started it. We can just ignore
// the error.
if !strings.Contains(string(output), "Error response from daemon: Conflict.") {
log. log.
Ctx(ctx). Ctx(ctx).
Error(). Error().
@ -124,6 +128,7 @@ func startBuildkit(ctx context.Context) error {
Msg("unable to start buildkitd") Msg("unable to start buildkitd")
return err return err
} }
}
return waitBuildkit(ctx) return waitBuildkit(ctx)
} }