Use pipeline status cache for last_pipeline on dashboards
What does this MR do and why?
Prior to this change, various dashboard views would call Gitaly once per pipeline status displayed, in order to resolve the latest pipeline SHA on HEAD.
But these dashboard views already preload #pipeline_status
for each
project, which includes the SHA of the latest pipeline for each project,
so there should be no need to call Gitaly.
This change introduces a feature flag last_pipeline_from_pipeline_status
to
use the cached SHA when loading the pipeline instead of calling Gitaly.
Spun out of !114047 (closed). See also #214037
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
- Check out this branch in your GDK
- With the feature flag off, visit the project dashboard. Make sure you see some pipeline status icons.
- In the performance bar, observe the number of calls made to Gitaly. This number should be > 0, otherwise something is wrong.
- Run
Feature.enable(:last_pipeline_from_pipeline_status)
in your rails console - Refresh the page.
- Observe:
- the pipeline status icons should remain the same
- the calls made to Gitaly should now be 0
Additional testing: Try running a new pipeline, canceling etc. Observe that the status icon on the dashboard changes.
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.