@@ -10,7 +10,6 @@ import (
|
||||
cueflow "cuelang.org/go/tools/flow"
|
||||
"github.com/rs/zerolog/log"
|
||||
"go.dagger.io/dagger/compiler"
|
||||
"go.dagger.io/dagger/environment"
|
||||
"go.dagger.io/dagger/pkg"
|
||||
"go.dagger.io/dagger/plan/task"
|
||||
"go.dagger.io/dagger/plancontext"
|
||||
@@ -207,7 +206,7 @@ func newRunner(pctx *plancontext.Context, s solver.Solver, computed *compiler.Va
|
||||
ctx, span := otel.Tracer("dagger").Start(ctx, fmt.Sprintf("up: %s", t.Path().String()))
|
||||
defer span.End()
|
||||
|
||||
lg.Info().Str("state", string(environment.StateComputing)).Msg(string(environment.StateComputing))
|
||||
lg.Info().Str("state", string(task.StateComputing)).Msg(string(task.StateComputing))
|
||||
|
||||
// Debug: dump dependencies
|
||||
for _, dep := range t.Dependencies() {
|
||||
@@ -219,14 +218,14 @@ func newRunner(pctx *plancontext.Context, s solver.Solver, computed *compiler.Va
|
||||
if err != nil {
|
||||
// FIXME: this should use errdefs.IsCanceled(err)
|
||||
if strings.Contains(err.Error(), "context canceled") {
|
||||
lg.Error().Dur("duration", time.Since(start)).Str("state", string(environment.StateCanceled)).Msg(string(environment.StateCanceled))
|
||||
lg.Error().Dur("duration", time.Since(start)).Str("state", string(task.StateCanceled)).Msg(string(task.StateCanceled))
|
||||
} else {
|
||||
lg.Error().Dur("duration", time.Since(start)).Err(err).Str("state", string(environment.StateFailed)).Msg(string(environment.StateFailed))
|
||||
lg.Error().Dur("duration", time.Since(start)).Err(err).Str("state", string(task.StateFailed)).Msg(string(task.StateFailed))
|
||||
}
|
||||
return fmt.Errorf("%s: %w", t.Path().String(), err)
|
||||
}
|
||||
|
||||
lg.Info().Dur("duration", time.Since(start)).Str("state", string(environment.StateCompleted)).Msg(string(environment.StateCompleted))
|
||||
lg.Info().Dur("duration", time.Since(start)).Str("state", string(task.StateCompleted)).Msg(string(task.StateCompleted))
|
||||
|
||||
// If the result is not concrete (e.g. empty value), there's nothing to merge.
|
||||
if !result.IsConcrete() {
|
||||
|
@@ -1,27 +0,0 @@
|
||||
package task
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.dagger.io/dagger/compiler"
|
||||
"go.dagger.io/dagger/environment"
|
||||
"go.dagger.io/dagger/plancontext"
|
||||
"go.dagger.io/dagger/solver"
|
||||
)
|
||||
|
||||
func init() {
|
||||
Register("#up", func() Task { return &pipelineTask{} })
|
||||
}
|
||||
|
||||
// pipelineTask is an adapter for legacy pipelines (`#up`).
|
||||
// FIXME: remove once fully migrated to Europa.
|
||||
type pipelineTask struct {
|
||||
}
|
||||
|
||||
func (c *pipelineTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.Solver, v *compiler.Value) (*compiler.Value, error) {
|
||||
p := environment.NewPipeline(v, s, pctx)
|
||||
if err := p.Run(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return p.Computed(), nil
|
||||
}
|
@@ -8,7 +8,6 @@ import (
|
||||
|
||||
"cuelang.org/go/cue"
|
||||
"go.dagger.io/dagger/compiler"
|
||||
"go.dagger.io/dagger/environment"
|
||||
"go.dagger.io/dagger/pkg"
|
||||
"go.dagger.io/dagger/plancontext"
|
||||
"go.dagger.io/dagger/solver"
|
||||
@@ -23,6 +22,16 @@ var (
|
||||
cue.Hid("_name", pkg.DaggerPackage))
|
||||
)
|
||||
|
||||
// State is the state of the task.
|
||||
type State string
|
||||
|
||||
const (
|
||||
StateComputing = State("computing")
|
||||
StateCanceled = State("canceled")
|
||||
StateFailed = State("failed")
|
||||
StateCompleted = State("completed")
|
||||
)
|
||||
|
||||
type NewFunc func() Task
|
||||
|
||||
type Task interface {
|
||||
@@ -52,9 +61,9 @@ func New(typ string) Task {
|
||||
|
||||
func Lookup(v *compiler.Value) (Task, error) {
|
||||
// FIXME: legacy pipelines
|
||||
if environment.IsComponent(v) {
|
||||
return New("#up"), nil
|
||||
}
|
||||
// if environment.IsComponent(v) {
|
||||
// return New("#up"), nil
|
||||
// }
|
||||
|
||||
if v.Kind() != cue.StructKind {
|
||||
return nil, ErrNotTask
|
||||
|
Reference in New Issue
Block a user