runner: fix empty CUE value check
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
b92905e175
commit
b5e2ba63c6
@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"cuelang.org/go/cue"
|
||||
"github.com/docker/buildx/util/buildflags"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/viper"
|
||||
@ -91,9 +92,9 @@ func FormatValue(val *compiler.Value) string {
|
||||
return "dagger.#Secret"
|
||||
}
|
||||
if val.IsConcreteR() != nil {
|
||||
return val.IncompleteKindString()
|
||||
return val.IncompleteKind().String()
|
||||
}
|
||||
if val.IncompleteKindString() == "struct" {
|
||||
if val.IncompleteKind() == cue.StructKind {
|
||||
return "struct"
|
||||
}
|
||||
|
||||
|
@ -59,6 +59,11 @@ func (v *Value) Kind() cue.Kind {
|
||||
return v.val.Kind()
|
||||
}
|
||||
|
||||
// Proxy function to the underlying cue.Value
|
||||
func (v *Value) IncompleteKind() cue.Kind {
|
||||
return v.Cue().IncompleteKind()
|
||||
}
|
||||
|
||||
// Field represents a struct field
|
||||
type Field struct {
|
||||
Selector cue.Selector
|
||||
@ -145,6 +150,10 @@ func (v *Value) List() ([]*Value, error) {
|
||||
return l, nil
|
||||
}
|
||||
|
||||
func (v *Value) IsConcrete() bool {
|
||||
return v.val.IsConcrete()
|
||||
}
|
||||
|
||||
// Recursive concreteness check.
|
||||
func (v *Value) IsConcreteR(opts ...cue.Option) error {
|
||||
o := []cue.Option{cue.Concrete(true)}
|
||||
@ -220,15 +229,6 @@ func (v *Value) Source(opts ...cue.Option) ([]byte, error) {
|
||||
)
|
||||
}
|
||||
|
||||
func (v *Value) IsEmptyStruct() bool {
|
||||
if st, err := v.Struct(); err == nil {
|
||||
if st.Len() == 0 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (v *Value) Cue() cue.Value {
|
||||
return v.val
|
||||
}
|
||||
@ -275,7 +275,3 @@ func (v *Value) Default() (*Value, bool) {
|
||||
func (v *Value) Doc() []*ast.CommentGroup {
|
||||
return v.Cue().Doc()
|
||||
}
|
||||
|
||||
func (v *Value) IncompleteKindString() string {
|
||||
return v.Cue().IncompleteKind().String()
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ func NewPipelineRunner(computed *compiler.Value, s solver.Solver, pctx *plancont
|
||||
}
|
||||
|
||||
// Mirror the computed values in both `Task` and `Result`
|
||||
if p.Computed().IsEmptyStruct() {
|
||||
if !p.Computed().IsConcrete() {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user