diff --git a/dagger/component.go b/dagger/component.go index ae0d0146..d831d4aa 100644 --- a/dagger/component.go +++ b/dagger/component.go @@ -41,11 +41,19 @@ func (c *Component) ComputeScript() (*Script, error) { } // Compute the configuration for this component. -// Note that we simply execute the underlying compute script from an -// empty filesystem state. -// (It is never correct to pass an input filesystem state to compute a component) +// +// Difference with Execute: +// +// 1. Always start with an empty fs state (Execute may receive any state as input) +// 2. Always solve at the end (Execute is lazy) +// func (c *Component) Compute(ctx context.Context, s Solver, out Fillable) (FS, error) { - return c.Execute(ctx, s.Scratch(), out) + fs, err := c.Execute(ctx, s.Scratch(), out) + if err != nil { + return fs, err + } + _, err = fs.ReadDir(ctx, "/") + return fs, err } // A component implements the Executable interface by returning its diff --git a/examples/repro-14/main.cue b/examples/repro-14/main.cue new file mode 100644 index 00000000..b2ebe7df --- /dev/null +++ b/examples/repro-14/main.cue @@ -0,0 +1,13 @@ +package main + +www: { + + source: { + #dagger: compute: [ + { + do: "fetch-container" + ref: "lalalalala", + }, + ] + } +}