Add retry job action to trigger job page
What does this MR do and why?
For #350243 (closed)
A trigger job (or bridge job) is a job whose purpose is to trigger/create a downstream pipeline. When the user goes to the show page for a trigger job and clicks on the Retry button, this will re-create a new downstream pipeline and trigger job, replacing the current one.
Note that the default behavior for trigger jobs is that the status will become success
when the downstream pipeline is created. The status of the trigger job is not synced or dependent on the status of the downstream pipeline.
No changelog added since this feature is behind a feature flag.
Note that there are follow ups to this that will not be covered in this MR:
- Only show latest downstream pipeline and trigger job in the pipeline graphs
- Redirect old trigger jobs to the latest trigger job
MR Breakdown
It might be easier to review this MR by going through the commits to see how the feature is put together.
Commit | Description |
---|---|
!78444 (033554f9) | Emit retryBridgeJob event from retry button in the sidebar |
!78444 (eb159475) | Add retry bridge mutation |
!78444 (da1462b1) | Poll for pipeline updates after retrying the bridge job (uses etag caching) |
!78444 (81c4668d) | Show error alert if the mutation fails |
!78444 (64c51a1e) | Handle behavior when mutation is successful |
Screenshots or screen recordings
Retrying a Trigger Job | With Error |
---|---|
success | error |
Retrying a trigger job will result in the following changes on the UI:
- A loading state will be displayed.
- While the mutation is not yet done, the retry button will be disabled.
- Trigger job status may show up as
pending
while the downstream pipeline is not yet created. It doesn't take long for a trigger job to finish though, so depending on the timing of the polling, it's possible thepending
state doesn't show up before the page is redirected. - Once the downstream pipeline is created, the page will redirect to the newly-created downstream pipeline.
How to set up and validate locally
- Pull the backend changes from !79636 (closed)
- Pull the frontend changes from this MR.
- Enable the
ci_retry_downstream_pipeline
feature flag. (rails c
thenFeature.enable(:ci_retry_downstream_pipeline)
) - Add the following content to your
.gitlab-ci.yml
file:stages: - build triggerJob: stage: build trigger: include: - project: "/path/to/project" # replace with another project file: ".gitlab-ci.yml"
- Wait for the pipeline to finish running.
- Visit the pipeline and click on the
triggerJob
job pill. This should take you to the job page fortriggerJob
. - Click on the Retry button in the sidebar.
- A new bridge job and downstream pipeline will be created, which you can now visit through the link in the middle of the page.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.