diff --git a/frontend/azlinux/handle_rpm.go b/frontend/azlinux/handle_rpm.go index c4635d0c4..6850e5efb 100644 --- a/frontend/azlinux/handle_rpm.go +++ b/frontend/azlinux/handle_rpm.go @@ -49,6 +49,10 @@ func handleRPM(w worker) gwclient.BuildFunc { return nil, nil, err } + if err := ref.Evaluate(ctx); err != nil { + return ref, nil, err + } + if imgRef, err := runTests(ctx, client, w, spec, sOpt, st, targetKey, pg); err != nil { // return the container ref in case of error so it can be used to debug // the installed package state. diff --git a/frontend/jammy/handle_deb.go b/frontend/jammy/handle_deb.go index 3a4cc8997..aca64dfbe 100644 --- a/frontend/jammy/handle_deb.go +++ b/frontend/jammy/handle_deb.go @@ -49,6 +49,10 @@ func handleDeb(ctx context.Context, client gwclient.Client) (*gwclient.Result, e return nil, nil, err } + if err := ref.Evaluate(ctx); err != nil { + return ref, nil, err + } + if ref, err := runTests(ctx, client, spec, sOpt, st, targetKey, opt); err != nil { cfg, _ := buildImageConfig(ctx, client, spec, platform, targetKey) return ref, cfg, err diff --git a/frontend/test_runner.go b/frontend/test_runner.go index 00dd59206..bb393e7ba 100644 --- a/frontend/test_runner.go +++ b/frontend/test_runner.go @@ -41,6 +41,14 @@ func RunTests(ctx context.Context, client gwclient.Client, spec *dalec.Spec, ref return nil } + if err := ref.Evaluate(ctx); err != nil { + // Force evaluation here so that any errors for the build itself can surface + // more cleanly. + // Otherwise an error for something wrong in the build (e.g. a failed compilation) + // will look like an error in a test (or all tests). + return err + } + ctr, err := ref.ToState() if err != nil { return err