Initial pass at engine.#Scratch
- failing
Signed-off-by: Joel Longtine <joel@dagger.io>
This commit is contained in:
31
plan/task/scratch.go
Normal file
31
plan/task/scratch.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package task
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/moby/buildkit/client/llb"
|
||||
"go.dagger.io/dagger/compiler"
|
||||
"go.dagger.io/dagger/plancontext"
|
||||
"go.dagger.io/dagger/solver"
|
||||
)
|
||||
|
||||
func init() {
|
||||
Register("Scratch", func() Task { return &scratchTask{} })
|
||||
}
|
||||
|
||||
type scratchTask struct {
|
||||
}
|
||||
|
||||
func (t *scratchTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.Solver, v *compiler.Value) (*compiler.Value, error) {
|
||||
st := llb.Scratch()
|
||||
result, err := s.Solve(ctx, st, pctx.Platform.Get())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fs := pctx.FS.New(result)
|
||||
|
||||
return compiler.NewValue().FillFields(map[string]interface{}{
|
||||
"output": fs.MarshalCUE(),
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user