fix dagger input dir

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2021-04-01 23:08:26 -07:00 committed by Solomon Hykes
parent 526d3af364
commit 5ae5b1bb50

View File

@ -81,10 +81,17 @@ type dirInput struct {
func (dir dirInput) Compile() (*compiler.Value, error) {
// FIXME: serialize an intermediate struct, instead of generating cue source
includeLLB, err := json.Marshal(dir.Include)
// json.Marshal([]string{}) returns []byte("null"), which wreaks havoc
// in Cue because `null` is not a `[...string]`
includeLLB := []byte("[]")
if len(dir.Include) > 0 {
var err error
includeLLB, err = json.Marshal(dir.Include)
if err != nil {
return nil, err
}
}
llb := fmt.Sprintf(
`#compute: [{do:"local",dir:"%s", include:%s}]`,
dir.Path,