Merge pull request #15 from blocklayerhq/sh

Non-breaking fixes.
This commit is contained in:
Solomon Hykes 2021-01-12 10:56:00 -08:00 committed by GitHub
commit 4f26c8ff4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 5 deletions

View File

@ -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

View File

@ -0,0 +1,13 @@
package main
www: {
source: {
#dagger: compute: [
{
do: "fetch-container"
ref: "lalalalala",
},
]
}
}

View File

@ -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