@@ -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