diff --git a/pkg/dagger.io/dagger/nop.cue b/pkg/dagger.io/dagger/nop.cue new file mode 100644 index 00000000..4e1d2580 --- /dev/null +++ b/pkg/dagger.io/dagger/nop.cue @@ -0,0 +1,10 @@ +package dagger + +// A core action that does nothing +// Useful to work around bugs in the DAG resolver. +// See for example https://github.com/dagger/dagger/issues/1789 +#Nop: { + $dagger: task: _name: "Nop" + input: _ + output: input +} diff --git a/plan/task/nop.go b/plan/task/nop.go new file mode 100644 index 00000000..8a7dfc81 --- /dev/null +++ b/plan/task/nop.go @@ -0,0 +1,20 @@ +package task + +import ( + "context" + + "go.dagger.io/dagger/compiler" + "go.dagger.io/dagger/plancontext" + "go.dagger.io/dagger/solver" +) + +func init() { + Register("Nop", func() Task { return &nopTask{} }) +} + +type nopTask struct { +} + +func (t *nopTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.Solver, v *compiler.Value) (*compiler.Value, error) { + return v, nil +}