From 3eef95dec5fdbb86d82ba0701d97dd75c6d18320 Mon Sep 17 00:00:00 2001 From: Daniel Levi-Minzi Date: Fri, 3 Jan 2025 12:40:45 -0500 Subject: [PATCH] 10 minute timeout for dockerfile build --- pkg/abstractions/image/build.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/abstractions/image/build.go b/pkg/abstractions/image/build.go index 65b3fc719..e9c533a95 100644 --- a/pkg/abstractions/image/build.go +++ b/pkg/abstractions/image/build.go @@ -210,14 +210,16 @@ func (i *BaseImage) String() string { // Build user image func (b *Builder) Build(ctx context.Context, opts *BuildOpts, outputChan chan common.OutputMsg) error { var ( - dockerfile *string - authInfo, _ = auth.AuthInfoFromContext(ctx) + dockerfile *string + authInfo, _ = auth.AuthInfoFromContext(ctx) + containerSpinupTimeout = defaultContainerSpinupTimeout ) switch { case opts.Dockerfile != "": opts.addPythonRequirements() dockerfile = &opts.Dockerfile + containerSpinupTimeout = 600 * time.Second case opts.ExistingImageUri != "": err := b.handleCustomBaseImage(opts, outputChan) if err != nil { @@ -329,7 +331,7 @@ func (b *Builder) Build(ctx context.Context, opts *BuildOpts, outputChan chan co return errors.New(fmt.Sprintf("container exited with error: %s\n", msg)) } - if time.Since(start) > defaultContainerSpinupTimeout && opts.Dockerfile == "" { + if time.Since(start) > containerSpinupTimeout { outputChan <- common.OutputMsg{Done: true, Success: false, Msg: "Timeout: container not running after 180 seconds.\n"} return errors.New("timeout: container not running after 180 seconds") }