Component.Compute: force "real" solve. Fixes #14.
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
This commit is contained in:
parent
0e484be9bd
commit
8b105003bb
@ -41,11 +41,19 @@ func (c *Component) ComputeScript() (*Script, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Compute the configuration for this component.
|
// Compute the configuration for this component.
|
||||||
// Note that we simply execute the underlying compute script from an
|
//
|
||||||
// empty filesystem state.
|
// Difference with Execute:
|
||||||
// (It is never correct to pass an input filesystem state to compute a component)
|
//
|
||||||
|
// 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) {
|
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
|
// A component implements the Executable interface by returning its
|
||||||
|
13
examples/repro-14/main.cue
Normal file
13
examples/repro-14/main.cue
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
www: {
|
||||||
|
|
||||||
|
source: {
|
||||||
|
#dagger: compute: [
|
||||||
|
{
|
||||||
|
do: "fetch-container"
|
||||||
|
ref: "lalalalala",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user