@@ -471,12 +471,16 @@ func (api *API) discoverDevcontainerProjects() error {
471
471
}
472
472
473
473
func (api * API ) discoverDevcontainersInProject (projectPath string ) error {
474
+ logger := api .logger .
475
+ Named ("project-discovery" ).
476
+ With (slog .F ("project_path" , projectPath ))
477
+
474
478
globalPatterns , err := ignore .LoadGlobalPatterns (api .fs )
475
479
if err != nil {
476
480
return xerrors .Errorf ("read global git ignore patterns: %w" , err )
477
481
}
478
482
479
- patterns , err := ignore .ReadPatterns (api .fs , projectPath )
483
+ patterns , err := ignore .ReadPatterns (api .ctx , logger , api . fs , projectPath )
480
484
if err != nil {
481
485
return xerrors .Errorf ("read git ignore patterns: %w" , err )
482
486
}
@@ -488,7 +492,14 @@ func (api *API) discoverDevcontainersInProject(projectPath string) error {
488
492
"/.devcontainer.json" ,
489
493
}
490
494
491
- return afero .Walk (api .fs , projectPath , func (path string , info fs.FileInfo , _ error ) error {
495
+ return afero .Walk (api .fs , projectPath , func (path string , info fs.FileInfo , err error ) error {
496
+ if err != nil {
497
+ logger .Error (api .ctx , "encountered error while walking for dev container projects" ,
498
+ slog .F ("path" , path ),
499
+ slog .Error (err ))
500
+ return nil
501
+ }
502
+
492
503
pathParts := ignore .FilePathToParts (path )
493
504
494
505
// We know that a directory entry cannot be a `devcontainer.json` file, so we
@@ -513,11 +524,11 @@ func (api *API) discoverDevcontainersInProject(projectPath string) error {
513
524
514
525
workspaceFolder := strings .TrimSuffix (path , relativeConfigPath )
515
526
516
- api . logger .Debug (api .ctx , "discovered dev container project" , slog .F ("workspace_folder" , workspaceFolder ))
527
+ logger .Debug (api .ctx , "discovered dev container project" , slog .F ("workspace_folder" , workspaceFolder ))
517
528
518
529
api .mu .Lock ()
519
530
if _ , found := api .knownDevcontainers [workspaceFolder ]; ! found {
520
- api . logger .Debug (api .ctx , "adding dev container project" , slog .F ("workspace_folder" , workspaceFolder ))
531
+ logger .Debug (api .ctx , "adding dev container project" , slog .F ("workspace_folder" , workspaceFolder ))
521
532
522
533
dc := codersdk.WorkspaceAgentDevcontainer {
523
534
ID : uuid .New (),
0 commit comments