From 9d1e7e2acc0e677b539d2463a78dfc1dc4f59985 Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Sat, 12 Mar 2022 06:39:41 +0000 Subject: [PATCH] dagger.#Nop: work around bugs in the DAG resolver Signed-off-by: Solomon Hykes --- pkg/dagger.io/dagger/nop.cue | 10 ++++++++++ plan/task/nop.go | 20 ++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 pkg/dagger.io/dagger/nop.cue create mode 100644 plan/task/nop.go 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 +}