fix dagger input dir
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
526d3af364
commit
5ae5b1bb50
@ -81,10 +81,17 @@ type dirInput struct {
|
|||||||
|
|
||||||
func (dir dirInput) Compile() (*compiler.Value, error) {
|
func (dir dirInput) Compile() (*compiler.Value, error) {
|
||||||
// FIXME: serialize an intermediate struct, instead of generating cue source
|
// 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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
llb := fmt.Sprintf(
|
llb := fmt.Sprintf(
|
||||||
`#compute: [{do:"local",dir:"%s", include:%s}]`,
|
`#compute: [{do:"local",dir:"%s", include:%s}]`,
|
||||||
dir.Path,
|
dir.Path,
|
||||||
|
Reference in New Issue
Block a user