Skip to content

Filter latest downstream pipelines for the pipeline editor mini graph

Mireya Andres requested to merge filter-latest-downstream-graphql into master

What does this MR do and why?

For #367547 (closed)

Retrying a trigger job will create a new downstream pipeline. Which means the pipeline graphs can show multiple outdated downstream pipelines.

This MR creates a util function for filtering out the outdated downstream pipelines via the sourceJob.retried property. If the the source job (trigger job) has retried = false, this means that it is the latest trigger job, which means the pipeline associated to it will be rendered.

This is tested on the mini pipeline graph for the pipeline editor, which uses GraphQL. Updates for other mini pipeline graphs (some of which use REST or Rails injection) will be done in future MRs.

Since the retry trigger job feature is not yet available, this should not affect how we render existing pipeline graphs today.

Screenshots or screen recordings

Before After
Screenshot_2023-01-27_at_17.19.27 Screenshot_2023-01-27_at_17.19.47

Main Pipeline Graph (for comparison)

Screenshot_2023-01-27_at_18.26.05

How to set up and validate locally

  1. Enable the ci_recreate_downstream_pipeline feature flag.

  2. Add the following to your .gitlab-ci.yml file.

    bridge_job:
      trigger:
        include: child-pipeline.yml

    child-pipeline.yml can have any simple script.

  3. Go to the pipeline graph for the pipeline triggered after saving the content. bridge_job should have a retry button.

  4. Click on the retry button to retry the trigger job. You can retry multiple times. You'll notice that the main pipeline graph will show ALL the downstream pipelines.

  5. Go back to the pipeline editor. Notice that the mini pipeline graph on the status bar only shows the LATEST downstream pipeline (only shows one circle, as opposed to the multiple downstream pipelines shown in the main pipeline graph).

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Mireya Andres

Merge request reports