Store pipeline ID in Redis for failed pipeline creation requests when pipeline is persisted
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
Currently, when a pipeline creation fails but the pipeline is still persisted (e.g., due to invalid .gitlab-ci.yml), the pipeline_id is not stored in the Redis metadata for the pipeline creation request. This makes it difficult to track and reference these failed pipelines from the creation request data.
Background
GitLab stores pipeline creation metadata in Redis for 5 minutes using Ci::PipelineCreation::Requests. The data structure includes:
-
status:in_progress,succeeded, orfailed -
error: Error message (only for failed creations) -
pipeline_id: Pipeline ID (currently only for successful creations)
There are still scenarios where:
- A pipeline creation request is marked as
failed - But a pipeline is still created and persisted with a
Failedstatus - The
pipeline_idis not stored in Redis for these cases
This happens because GitLab intentionally persists pipelines for certain failure types (like config errors) to surface errors to users in contexts where config errors can't be easily displayed (e.g., MR pipelines page).
Proposed Solution
Modify Ci::PipelineCreation::Requests.failed to accept an optional pipeline_id parameter and store it in Redis when a pipeline has been persisted despite the failure.
This would allow us to show the failed pipeline immediately in the UI without additional queries.