Repository navigation
fix: Announce agent migrations after the settings commit - #4759
Open
maciaszczykm wants to merge 2 commits into
Open
maciaszczykm wants to merge 2 commits into
maciaszczykm wants to merge 2 commits into
Conversation
Contributor
[Medium impact] The PR appears safe to merge. SummaryThe PR inserts agent migrations inside the settings transaction and announces them after it finishes.
No actionable issues found. Tests were reviewed but not run. Reviews (1) · Last reviewed commit: "announce agent migrations after the sett..." · Reviewed by Greptile |
| end | ||
|
|
||
| # announces a migration only after its transaction commits, so applying it sees the committed settings | ||
| defp notify_migration({:ok, %{migration: %AgentMigration{} = migration} = result}, key, user) do |
Member
There was a problem hiding this comment.
this priv function is kind of overcall, just do the same logic in a case at the end of the calling function instead. Also don't know if we really need the notify_agent_migration function, can just do the bare notify inline too.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Settings.update/2creates the agent migration inside its transaction, andcreate_agent_migration/2broadcastsAgentMigrationCreatedstraight away. The recursive handler then runsapply_migration/1in another process, which reads the settings withfetch_consistent/0before the transaction commits. When the values andagent_helm_values_templateablechange together, as they do the first timeagentHelmValuesTemplateis set, it sees the old flag, skips templating, and writes the raw Liquid template to every agent service. The operator then fails with "yaml: found character that cannot start any token" and stops syncing.Migrations are now inserted inside the transaction and announced after it commits, in both
update/2andmigrate_agents/2.create_agent_migration/2keeps its behaviour for the GraphQL mutation.Test Plan
Tests in
settings_test.exscheck that the migration is announced outside the transaction, with the new settings visible, for both settings updates and agent version bumps, and that a failed update announces nothing.Found on a fresh
plural upon Azure.