Add logging to debug CI config local file fetch failures
What does this MR do and why?
Add logging to debug CI config local file fetch failures
This adds structured logging to help debug intermittent 'Local file .gitlab-ci.yml does not exist!' errors that seem to be occurring in distributed Gitaly/Praefect setups.
Logging Strategy
Based on discussion in the RFH, this MR implements feature-flag-gated logging following the pattern used by expanded_ai_logging:
-
Failure signals (always logged at
warnlevel):- Missing blobs from Gitaly response
- GRPC errors during blob fetch
- Nil content when validating local file
-
Verbose tracing (gated by
ci_config_local_file_verbose_loggingfeature flag):- Request details before fetching blobs
- Successful response details
This allows operators to selectively enable detailed logging for specific projects experiencing the issue, without adding noise to all instances.
Related to: #336789
Changelog: other
References
- RFH: https://gitlab.com/gitlab-com/request-for-help/-/issues/4159
- Feature flag pattern precedent:
expanded_ai_loggingfor AI features
How to set up and validate locally
-
Enable verbose logging for a specific project:
Feature.enable(:ci_config_local_file_verbose_logging, Project.find(123)) -
Create a pipeline with local includes and check
log/application.log:- With flag disabled: only
warnlogs appear for failures (missing blobs, GRPC errors, nil content) - With flag enabled:
infologs appear for all request/response cycles
- With flag disabled: only
-
To enable globally (e.g., for debugging on a specific instance):
Feature.enable(:ci_config_local_file_verbose_logging) -
To disable:
Feature.disable(:ci_config_local_file_verbose_logging)
Example log output
When a local file is missing (always logged):
{
"severity": "WARN",
"message": "CI config: Blobs fetched from Gitaly - missing paths detected",
"project_id": 123,
"sha": "abc123",
"missing_paths": [".gitlab-ci.yml"],
"missing_count": 1,
"repository_storage": "default",
"gitaly_storage_name": "default"
}
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.