(ctx context.Context, ref string)
| 324 | } |
| 325 | |
| 326 | func (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 |
no test coverage detected