Skip to content

Show failed jobs in MR pipelines tab part 1

Frédéric Caplette requested to merge fc-add-failed-jobs-in-mr-part-1 into master

What does this MR do and why?

Add failed jobs tract to MR pipelines tab

Behind a FF we add the ability to see failed jobs trace directly inside the pipelines tab of a MR. Failed jobs are only fetched when clicking on the button to expand the table. Then each failed jobs is fetched and can be clicked on to expand the job log and see why the job failed.

IMPORTANT Feature specs are also going to be written in the very last MR (or a separate MR, depending on size) to keep these really focus on FE only.

This is part 1 of 5 in a series of MR!

In this MR, we introduce 3 key aspect:

  1. The FF ci_job_failures_in_mr is added
  2. Since the pipeline_tables is a shared component, we want to only render this if the app subscribe to this option. This has been provided (pun intended) with the provide API as a static value that we can pass when mounting the app to have this option enable. For now, only the pipelines table inside the merge request tab will have this feature, but potentially we could enable it in other areas.
  3. Adds a simple text "Show failed jobs" which is unclickable for now.

MR table:

Title Link
Introduce FF and base component 👈🏻 You are here
Fetch failed jobs !122917 (merged)
Display each failed job in a row with log !122921 (merged)
Add action button to each job row !123086 (merged)
Add polling when the widget is opened

this is behind a disabled feature flag: ci_job_failures_in_mr.

Preview

If you are wondering what it will look like after all the MRs are done, here is a quick preview of what the PoC looked like:

Screen_Recording_2023-06-05_at_3.18.34_PM

Screenshots or screen recordings

In MR

Before After
Screenshot_2023-06-07_at_10.28.43_AM Screenshot_2023-06-07_at_10.08.17_AM

In Pipelines (Nothing changed)

Before After
Screenshot_2023-06-07_at_10.09.56_AM Screenshot_2023-06-07_at_10.09.56_AM

How to set up and validate locally

  1. Enable feature flag in rails console `Feature.enable(:ci_job_failures_in_mr)
  2. Make sure to have a functioning runner
  3. We need a MR with jobs failures. An easy to do so is to make a merge request on the ci config file and add explicit failures
  4. Navigate to Build -> Pipeline Editor
  5. Change your config to include jobs failures like so:
my_failed_job:
  script: exit 1
  1. Create a merge request with that change
  2. Navigate to the Merge request page
  3. Go to the pipelines page
  4. Notice the new link "Show failed jobs

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 Frédéric Caplette

Merge request reports