MCPcopy
hub / github.com/dagger/dagger / getModuleConfig

Method getModuleConfig

cmd/dagger/shell_fs.go:326–401  ·  view source on GitHub ↗
(ctx context.Context, ref string)

Source from the content-addressed store, hash-verified

324}
325
326func (h *shellCallHandler) getModuleConfig(ctx context.Context, ref string) (rcfg *configuredModule, rerr error) {
327 if h.Debug() {
328 defer func() {
329 shellDebug(ctx, "getModuleConfig", ref, rcfg)
330 }()
331 }
332 ctx, span := Tracer().Start(ctx, "detect module: "+ref)
333 defer telemetry.EndWithCause(span, &rerr)
334
335 src := h.dag.ModuleSource(ref)
336
337 // could be a git repo without a dagger.json in a parent directory
338 // (i.e., doesn't return an error)
339 exists, err := src.ConfigExists(ctx)
340 if !exists {
341 return nil, err
342 }
343
344 var srcRef string
345 var srcPin string
346 var subpath string
347 var digest string
348
349 eg, gctx := errgroup.WithContext(ctx)
350
351 // ref could be a subpath so we get the right module root ref
352 eg.Go(func() error {
353 v, err := src.AsString(gctx)
354 if err != nil {
355 return err
356 }
357 srcRef = v
358 return nil
359 })
360
361 // ref could be a dependency name
362 eg.Go(func() error {
363 v, err := src.Pin(gctx)
364 if err != nil {
365 return err
366 }
367 srcPin = v
368 return nil
369 })
370
371 eg.Go(func() error {
372 v, err := src.OriginalSubpath(gctx)
373 if err != nil {
374 return err
375 }
376 subpath = v
377 return nil
378 })
379
380 eg.Go(func() error {
381 v, err := src.Digest(gctx)
382 if err != nil {
383 return err

Callers 1

parseModRefMethod · 0.95

Calls 12

DebugMethod · 0.95
shellDebugFunction · 0.85
TracerFunction · 0.70
StartMethod · 0.65
DigestMethod · 0.65
WaitMethod · 0.65
ModuleSourceMethod · 0.45
ConfigExistsMethod · 0.45
GoMethod · 0.45
AsStringMethod · 0.45
PinMethod · 0.45
OriginalSubpathMethod · 0.45

Tested by

no test coverage detected