Update CommitSha in pipeline editor when switching branches
What does this MR do?
For #333369 (closed) and #332845 (closed).
When the user switches branches in the pipeline editor, we need to make sure that the CommitSha
value in apollo cache is updated with the latest commit sha for the new branch.
This change affects two issues:
- This is needed for #332845 (closed) so we can send the updated commit sha to the backend and fetch the correct merged yaml content for non-default branches. The actual updating of the
CiConfig
query to use the updated commit sha will is implemented in !64574 (merged). - This also fixes the bug mentioned in #333369 (closed) where the pipeline status does not show the latest pipeline for non-default branches. Right now, it will constantly show the latest pipeline for default branch regardless of the current branch the user sets the pipeline editor to.
A follow-up issue has been created in #335074 (closed) to refactor the handling of commit sha here, based on the discussion below in !64576 (comment 615547809). This will handle unifying the source of truth of commit sha and removing the client resolver in favor of setting it as a query. For now, the commit sha is updated using a local mutation, which
Screenshots
Updated commit sha in pipeline status
Does this MR meet the acceptance criteria?
Conformity
-
I have included changelog trailers, or none are needed. (Does this MR need a changelog?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides.
Availability and Testing
-
I have added/updated tests following the Testing Guide, or it's not needed. (Consider all test levels. See the Test Planning Process.)
Edited by Mireya Andres