Skip to content

Add a retry button to a downstream pipeline on the pipeline graph

Description

We are adding a retry button in the pipeline graph on the downstream cards. The card itself represent a pipeline downstream of the the current one and you might want to retry the failed jobs right from the current project instead of going to the other one. With the current implementation, we also add this button to upstreams.

To add this button, we need to change the shape of the card a little bit. We also need to update the graphql query of the pipeline fetch. We need to fetch retryable and cancelable field from the downstream pipeline.

The work will be behind a disabled feature flag called downstream_retry_action. This is the rollout issue

Testing plan

  1. Given the pipeline is successful, show no action
  2. Given the pipeline is running, show cancel. Can click cancel and status move to cancelled.
  3. Given the pipeline has failed, show retry. Can click retry and status move to running.
  4. Given the pipeline is cancelled, show retry. Can click retry and status move to running.

Screenshots or videos

Before After
Screen_Shot_2022-04-08_at_10.31.13_AM Screen_Shot_2022-04-08_at_10.35.50_AM

Upstreams card have no actions (before and after)

Before after
Screen_Shot_2022-04-12_at_11.47.27_AM Screen_Shot_2022-04-12_at_11.47.27_AM

Retrying downstream (new)

linked_pipeline_downstream_after

How to test locally

  • Setup local runners on your GDK
  • Create a multi-project pipeline. Here is a simple config:
stages:
  - build
  - test
  - deploy

hi:
  stage: "test"
  script: "echo I run only on master"

hi2:
  stage: "deploy"
  script: "echo I run only on master"
  needs: ['hi']

trigger_other_project_okay_really:
  stage: deploy
  trigger:
    include:
      - project: "root/large-pipeline" # replace with another project
        file: ".gitlab-ci.yml"

Then in the other project, any config will do:

job_from_other_project:
  script: echo hello
  • Make sure it is linked to another one of your local project
  • Make the downstream pipeline fail/cancel a job
  • Notice the retry action will appear on the downstream card
  • You can do the same with the upstream (cancel a job)
  • Then go to the downstream project in the related pipeline
  • Notice the upstream has the retry action
  • Click Retry
  • Expand the multi project pipeline graph
  • Notice that the cancelled job has restarted

Related to #354974 (closed)

Edited by Frédéric Caplette

Merge request reports

Loading