environments only ignore the compute layer if it is empty instead of logging a fatal error
Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
parent
10d1b01f2a
commit
06a515f496
@ -2,7 +2,6 @@ package environment
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"strings"
|
"strings"
|
||||||
@ -325,22 +324,20 @@ func (e *Environment) ScanInputs(ctx context.Context, mergeUserInputs bool) ([]*
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e *Environment) ScanOutputs(ctx context.Context) ([]*compiler.Value, error) {
|
func (e *Environment) ScanOutputs(ctx context.Context) ([]*compiler.Value, error) {
|
||||||
if e.state.Computed == "" {
|
|
||||||
return nil, errors.New("environment has been computed yet")
|
|
||||||
}
|
|
||||||
|
|
||||||
src, err := e.prepare(ctx)
|
src, err := e.prepare(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
computed, err := compiler.DecodeJSON("", []byte(e.state.Computed))
|
if e.state.Computed != "" {
|
||||||
if err != nil {
|
computed, err := compiler.DecodeJSON("", []byte(e.state.Computed))
|
||||||
return nil, err
|
if err != nil {
|
||||||
}
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
if err := src.FillPath(cue.MakePath(), computed); err != nil {
|
if err := src.FillPath(cue.MakePath(), computed); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return scanOutputs(ctx, src), nil
|
return scanOutputs(ctx, src), nil
|
||||||
|
Reference in New Issue
Block a user