MCPcopy Index your code
hub / github.com/dagger/dagger / runAsCheck

Method runAsCheck

core/modtree.go:139–170  ·  view source on GitHub ↗

runAsCheck runs a leaf node as a check, with telemetry span and optional scale-out.

(
	ctx context.Context,
	isLeaf func(*ModTreeNode) bool,
	tryScaleOut func(*ModTreeNode, context.Context) (bool, error),
	runLocally func(*ModTreeNode, context.Context) error,
	include, exclude []string,
)

Source from the content-addressed store, hash-verified

137
138// runAsCheck runs a leaf node as a check, with telemetry span and optional scale-out.
139func (node *ModTreeNode) runAsCheck(
140 ctx context.Context,
141 isLeaf func(*ModTreeNode) bool,
142 tryScaleOut func(*ModTreeNode, context.Context) (bool, error),
143 runLocally func(*ModTreeNode, context.Context) error,
144 include, exclude []string,
145) error {
146 return node.Run(ctx,
147 isLeaf,
148 func(ctx context.Context, n *ModTreeNode, clientMD *engine.ClientMetadata) (rerr error) {
149 // Try scale-out if enabled (will be false for scaled-out sessions)
150 if clientMD != nil && clientMD.EnableCloudScaleOut {
151 if ok, err := tryScaleOut(n, ctx); ok {
152 return err
153 }
154 }
155 ctx, span := Tracer(ctx).Start(ctx, n.PathString(),
156 telemetry.Reveal(),
157 trace.WithAttributes(
158 attribute.Bool(telemetry.UIRollUpLogsAttr, true),
159 attribute.Bool(telemetry.UIRollUpSpansAttr, true),
160 attribute.String(telemetry.CheckNameAttr, n.PathString()),
161 ),
162 )
163 defer func() {
164 span.SetAttributes(attribute.Bool(telemetry.CheckPassedAttr, rerr == nil))
165 telemetry.EndWithCause(span, &rerr)
166 }()
167 return runLocally(n, ctx)
168 },
169 include, exclude)
170}
171
172func (node *ModTreeNode) runGeneratorAsCheckLocally(ctx context.Context) error {
173 changes, err := node.runGeneratorLocally(ctx)

Callers 2

RunCheckMethod · 0.95
RunGeneratorAsCheckMethod · 0.95

Calls 7

RunMethod · 0.95
PathStringMethod · 0.80
SetAttributesMethod · 0.80
TracerFunction · 0.70
StartMethod · 0.65
BoolMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected