Finalize switch to dagger: task: _name

Signed-off-by: Joel Longtine <joel@dagger.io>
This commit is contained in:
Joel Longtine 2021-12-20 10:41:52 -07:00
parent 1ea035ff16
commit 1f28ce518d
2 changed files with 15 additions and 28 deletions

View File

@ -2,9 +2,7 @@ package task
import ( import (
"context" "context"
"fmt"
"cuelang.org/go/cue"
"github.com/moby/buildkit/client/llb" "github.com/moby/buildkit/client/llb"
"go.dagger.io/dagger/compiler" "go.dagger.io/dagger/compiler"
"go.dagger.io/dagger/plancontext" "go.dagger.io/dagger/plancontext"
@ -40,14 +38,11 @@ func (t *copyTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.
} }
sourceState, err := sourceRoot.Result().ToState() sourceState, err := sourceRoot.Result().ToState()
if err != nil { if err != nil {
return nil, err return nil, err
} }
sourcePath, err := v.Lookup("source.path").String() sourcePath, err := v.Lookup("source.path").String()
fmt.Println(sourcePath)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -82,11 +77,15 @@ func (t *copyTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.
fs := pctx.FS.New(result) fs := pctx.FS.New(result)
output := compiler.NewValue() return compiler.NewValue().FillFields(map[string]interface{}{
"output": fs.MarshalCUE(),
})
if err := output.FillPath(cue.ParsePath("output"), fs.MarshalCUE()); err != nil { // output := compiler.NewValue()
return nil, err
}
return output, nil // if err := output.FillPath(cue.ParsePath("output"), fs.MarshalCUE()); err != nil {
// return nil, err
// }
// return output, nil
} }

View File

@ -59,11 +59,15 @@ package engine
// Copy files from one FS tree to another // Copy files from one FS tree to another
#Copy: { #Copy: {
@dagger(notimplemented) // @dagger(notimplemented)
$dagger: task: _name: "Copy" $dagger: task: _name: "Copy"
input: #FS input: #FS
#CopyInfo source: {
root: #FS
path: string | *"/"
}
dest: string
output: #FS output: #FS
} }
@ -84,19 +88,3 @@ package engine
layers: [...#CopyInfo] layers: [...#CopyInfo]
output: #FS output: #FS
} }
#Copy: {
_type: "Copy"
input: #FS
#CopyInfo
output: #FS
}
#CopyInfo: {
source: {
root: #FS
path: string | *"/"
}
dest: string
}