Pipeline graph in MR widget includes all failed instances of a retried job in downstream pipelines
Summary
When retrying a failed job in a MR pipeline, the pipeline mini graph in the MR pipeline widget will show all the failed versions of this job instead of only the most recent (running) instance if that job is in a downstream pipeline.
Steps to reproduce
Use this YAML config:
stages:
- trigger
- downstream
trigger_downstream:
stage: trigger
rules:
- if: $CI_PIPELINE_SOURCE != "parent_pipeline"
trigger:
include:
- local: .gitlab-ci.yml
strategy: mirror
variables:
TRIGGERED: "true"
auto_success:
stage: downstream
rules:
- if: $TRIGGERED == "true"
script:
- echo "This job runs automatically"
auto_failure:
stage: downstream
rules:
- if: $TRIGGERED == "true"
script:
- echo "This job fails automatically"
- exit 1
- Create a new MR
- Wait for
auto_failurejob to fail - Retry the job
- Refresh the page
- Open the list of jobs in the
downstreamstage - Observe the failed and retried job both showing
- Repeat, see all failed versions in the list
Example Project
Verified it in this MR, you can check the downstream pipelines graph for pipeline 2152405143 there: gl-demo-ultimate-mgrabowski/test!70 (closed)
What is the current bug behavior?
All failed job instances are shown
What is the expected correct behavior?
Only the most recent retry is shown
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com
Possible fixes
Code snippets from Slack conversation:
expose :retried do |pipeline|
pipeline.source_job&.retried
end
expose :ordered_retried_statuses, as: :retried, if: ->(_, opts) { opts[:retried] }, with: Ci::JobEntity
