-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: race condition when updating registry settings #4036
Conversation
(cherry picked from commit 004d72d)
skipImagePush := updateAppRegistryRequest.IsReadOnly | ||
if foundApp.IsAirgap { | ||
// TODO: pushing images not yet supported in airgapped instances. | ||
skipImagePush = true | ||
} | ||
|
||
latestSequence, err := store.GetStore().GetLatestAppSequence(foundApp.ID, true) | ||
if err != nil { | ||
logger.Error(errors.Wrapf(err, "failed to get latest app sequence for app %s", foundApp.Slug)) | ||
updateAppRegistryResponse.Error = err.Error() | ||
JSON(w, http.StatusInternalServerError, updateAppRegistryResponse) | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this bit out of the goroutine since we don't want to set an initial task status of "running"
if the query fails.
@@ -22,7 +22,7 @@ metadata: | |||
name: capacity-res-job | |||
spec: | |||
parallelism: 4 | |||
backoffLimit: 0 | |||
backoffLimit: 6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to the issue, but should fix flakiness we've been seeing in this test as it will allow this job, which reserves GKE autopilot capacity, to be retried.
(cherry picked from commit 004d72d)
What this PR does / why we need it:
This PR fixes a race condition where the backend would return a response from the PUT
/api/v1/app/{appSlug}/registry
handler before the image re-writing task started. This could result in a scenario where the UI polls the/api/v1/app/{appSlug}/imagerewritestatus
endpoint before there is a task status, so the backend will return a response indicating that image re-writing is complete even though it has not even begun. This causes the UI to not display the spinner and status messages, as expected.Example of this in our tests: https://app.testim.io/#/project/wpYAooUimFDgQxY73r17/branch/ricardomaraschini%2Fsc-86964%2Fkots-test-workflow-for-helmvm/test/aPhWnwQiqtBxx2sn/step/wbZJmRizYrvNWuVc/viewer/screenshots?result-id=XCLtQZlJnzWmYF5k&path=w5blTCkqUInoZuUc%3AwbZJmRizYrvNWuVc
Which issue(s) this PR fixes:
See testim link above...
Special notes for your reviewer:
Changed the Registry Settings step in
validate-smoke-test
to mark an error if the loading indicator does not show to add coverage for the UI (link).Steps to reproduce
It's a race condition, so only happens occasionally. To reproduce, change the registry settings and save. The UI will not always show the loading indicator and status messages.
Does this PR introduce a user-facing change?
Does this PR require documentation?
NONE