dagger.#Nop: work around bugs in the DAG resolver

Signed-off-by: Solomon Hykes <solomon@dagger.io>
This commit is contained in:
Solomon Hykes 2022-03-12 06:39:41 +00:00
parent aacabb1393
commit 9d1e7e2acc
2 changed files with 30 additions and 0 deletions

View File

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

20
plan/task/nop.go Normal file
View File

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