commit
4f26c8ff4f
@ -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",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -17,7 +17,8 @@ let base=alpine & {
|
|||||||
www: {
|
www: {
|
||||||
|
|
||||||
source: {
|
source: {
|
||||||
#dagger: compute: []
|
// Make this undefined on purpose to require an input directory.
|
||||||
|
#dagger: compute: _
|
||||||
}
|
}
|
||||||
|
|
||||||
host: string
|
host: string
|
||||||
|
Reference in New Issue
Block a user