fix dependencies between tasks
due to using an old snapshot of cue.Value, components relying on dependent tasks were failing because of non-concretness. Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
committed by
Solomon Hykes
parent
af9581c28a
commit
78601fefd6
@@ -280,24 +280,30 @@ func (env *Env) Walk(ctx context.Context, fn EnvWalkFunc) (*Value, error) {
|
||||
}
|
||||
// Cueflow match func
|
||||
flowMatchFn := func(v cue.Value) (cueflow.Runner, error) {
|
||||
lg := lg.
|
||||
With().
|
||||
Str("path", v.Path().String()).
|
||||
Logger()
|
||||
ctx := lg.WithContext(ctx)
|
||||
|
||||
lg.Debug().Msg("Env.Walk: processing")
|
||||
// FIXME: get directly from state Value ? Locking issue?
|
||||
val := env.cc.Wrap(v, flowInst)
|
||||
c, err := NewComponent(val)
|
||||
if os.IsNotExist(err) {
|
||||
// Not a component: skip
|
||||
return nil, nil
|
||||
}
|
||||
if err != nil {
|
||||
if _, err := NewComponent(env.cc.Wrap(v, flowInst)); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
// Not a component: skip
|
||||
return nil, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
return cueflow.RunnerFunc(func(t *cueflow.Task) error {
|
||||
lg := lg.
|
||||
With().
|
||||
Str("path", t.Path().String()).
|
||||
Logger()
|
||||
ctx := lg.WithContext(ctx)
|
||||
|
||||
c, err := NewComponent(env.cc.Wrap(t.Value(), flowInst))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, dep := range t.Dependencies() {
|
||||
lg.
|
||||
Debug().
|
||||
Str("dependency", dep.Path().String()).
|
||||
Msg("dependency detected")
|
||||
}
|
||||
return fn(ctx, c, NewFillable(t))
|
||||
}), nil
|
||||
}
|
||||
|
@@ -165,7 +165,10 @@ func (op *Op) Exec(ctx context.Context, fs FS, out *Fillable) (FS, error) {
|
||||
Dir string
|
||||
Always bool
|
||||
}
|
||||
op.v.Decode(&cmd)
|
||||
|
||||
if err := op.v.Decode(&cmd); err != nil {
|
||||
return fs, err
|
||||
}
|
||||
// marker for status events
|
||||
// FIXME
|
||||
opts = append(opts, llb.WithCustomName(op.v.Path().String()))
|
||||
|
@@ -64,6 +64,7 @@ func (s *Script) Execute(ctx context.Context, fs FS, out *Fillable) (FS, error)
|
||||
log.
|
||||
Ctx(ctx).
|
||||
Warn().
|
||||
Err(err).
|
||||
Int("op", idx).
|
||||
// FIXME: tell user which inputs are missing (by inspecting references)
|
||||
Msg("script is missing inputs and has not been fully executed")
|
||||
|
Reference in New Issue
Block a user