Skip to content

Make artifacts dropdown refetch list on show at 'Pipelines'

What does this MR do and why?

Why

At 'Pipelines' artifacts dropdown content is loaded only once regardless live-update. Thus at least two use cases are negatively affected:

  • When live-update shifts pipelines_list, view elements are reused, so some dropdown may list other pipeline's artifacts after having been shown once;
  • During a long-time multi-artifact pipeline, one can't poll a dropdown for currently available artifacts.

Page refresh solves both cases, but is inconsistent with live-update.

What

This MR makes dropdown refetch its list on each show.

Changes introduced by this branch:

  1. @show.once is changed to @show to make fetchArtifacts called every time on show;
  2. The old list in fetchArtifacts is preserved to be presented in case of a request failure;
  3. A watcher for pipelineId: the pipeline bound to the row may change between the last successful fetch and the new failed one, so we set the old list if it hasn't and an empty list otherwise;
  4. A warning about old list is appended as a dropdown footer in case of a failure (+new string at 'gitlab.pot');
  5. The current list in fetchArtifacts is cleared before updated to prevent the old content to be shown in dropdown while loading;
  6. hasError is cleared in fetchArtifacts before the request to exclude warning/error messages while loading;
  7. New specs added for the following cases: a refetch in progress, a successful refetch with a new list, a failed refetch, a change of pipeline ID.

Screenshots or screen recordings

Videos

Before After
anime-before-2 anime-after-1
(35 seconds) (25 seconds)
See how all new pipeline's artifacts are listed as ready before jobs are finished; old job ID in URL popping up; dropdown progress spinner shown only once. See the list of dropped down artifacts being up-to-date with the corresponding pipeline's flow; dropdown progress spinner shown on every click.

Screenshots

Image Description
gitlab-errmes-poc-3 The footer warning is appended in case of a failed refetch after a successful one with a non-empty list: e.g. the user caught a failure while polling the dropdown for a specific artifact of a long-time multi-stage pipeline. The warning is required, because the user may see the stage as completed and no corresponding artifact listed, which is confusing.

How to set up and validate locally

Steps to reproduce the bug:

  1. Create a project, configure CI to generate artifacts (e.g. RoR template project fits perfectly);
  2. In a browser open a new tab, visit '<project>/Build/Pipelines' page;
  3. Click 'Run pipeline', then 'Run pipeline';
  4. Wait for the pipeline to finish;
  5. Visit 'Pipelines' page again;
  6. Click the 'Download artifacts' button, note that the dropdown progress ring spinned a bit;
  7. Once artifacts are listed, remember their URL-s (job numbers will be sufficient);
  8. Leave the tab, open another tab, visit 'Pipelines' there;
  9. Click 'Run pipeline', then 'Run pipeline';
  10. Switch to the first tab;
  11. Wait until live-update inserts the new pipeline to the top of the list;
  12. Click the 'Download artifacts' button of the new pipeline, note that the progress ring doesn't appear anymore;
  13. Check new artifacts and their URL-s - artifacts are listed before corresponding jobs are finished, and job numbers are the same, as for an older pipeline.

If you see the spinner every time in 12 and see correct job numbers linked in 13, then you may consider the bug fixed.

Actually, the bug is easily reproduced even at GitLab.org's 'Pipelines' page: find a pipeline with some artifacts built, open/close its dropdown, dont't close the tab, but leave it be. Come back a bit later and check out the same row - it'll still show the same artifacts, despite all pipelines you've searched through most likely have gone.

MR acceptance checklist

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

Related to #367955

Edited by Andrew Trifonenkov

Merge request reports