Skip to content

Draft: Redirect old trigger jobs to the latest trigger jobs

Mireya Andres requested to merge redirect-old-trigger-jobs into master

What does this MR do and why?

For #352472 (closed)

The graphql for the pipeline query only gives information about latest trigger jobs in that pipeline. Since information about old trigger jobs are unavailable, the show page for the trigger job page will not render properly when the user visits the link for old trigger jobs. After much discussion, it's decided that we will redirect the user to the latest trigger job instead when the frontend recognizes that the user is trying to view an old trigger job.

No changelog added since the feature is under a feature flag.

Latest commit has the relevant changes; other commits will be removed after a proper rebase (once the retry trigger job code is merged).

Screenshots or screen recordings

Screen_Recording_2022-02-17_at_16.03.07

How to set up and validate locally

  1. Enable the ci_retry_downstream_pipeline feature flag. (rails c then Feature.enable(:ci_retry_downstream_pipeline))
  2. Add the following content to your .gitlab-ci.yml file. This will create the trigger job triggerJob and create a downstream pipeline based on the contents of .gitlab-ci.yml in your other project.
    stages:
      - build
    
    triggerJob:
      stage: build
      trigger:
        include:
          - project: "/path/to/project" # replace with another project
            file: ".gitlab-ci.yml"
  3. Wait for the pipeline to finish running.
  4. Visit the pipeline and click on the triggerJob job pill. This should take you to the job page for triggerJob. Take note of the trigger job ID in the URL.
  5. Click on the Retry button in the sidebar. After a while, you will be redirected to the newly created downstream pipeline.
  6. Click on the back button. This should redirect you to the old trigger job (same ID as the when you first visited the trigger job page). The page will recognize that you are trying to visit an old trigger job and will automatically redirect you to the new trigger job.

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