-
Notifications
You must be signed in to change notification settings - Fork 167
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(controller): improve logic to determine when syncing an argo cd app is required #2433
Conversation
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
✅ Deploy Preview for docs-kargo-akuity-io canceled.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2433 +/- ##
==========================================
+ Coverage 48.38% 48.48% +0.10%
==========================================
Files 245 245
Lines 17761 17757 -4
==========================================
+ Hits 8593 8610 +17
+ Misses 8748 8725 -23
- Partials 420 422 +2 ☔ View full report in Codecov by Sentry. |
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.
This is absolutely better, and much more resilient than what I came up with. 💯 for thinking about the operation info field! 🧠🥇
Successfully created backport PR for |
Fixes #2427
925b765 (the second commit) is the actual bug fix and is pretty straightforward. It modifies the sync operations we initiate to include the id of the Freight collection that is being promoted. We check for this information when determining if we need to initiate a sync operation. This allows a promotion to wait for a sync operation to complete in cases where we previously would not have simply for lack of any means to determine whether the completed sync operation was indeed the one we'd been waiting for.
fe15116 (the first commit) changes the interface of promotion mechanisms to be quite a bit cleaner. The bug fix described above required the Argo CD app update promotion mechanism to have access to the Freight collection ID. It could obtain it from
promo.Status.FreightCollection.ID
. Doing this made me realize how seemingly redundant it was that promotion mechanisms were also receiving and returning[]kargoapi.FreightReference
, since there is already access to the Freight collection. In fact, it was not entirely redundant because promotion mechanisms can make certain modifications to those Freight references (like set health check commit IDs) and return them, and then those modified references become the input to the next promotion mechanism. The situation was quite similar for Promotion status, which could be modified by each mechanism and returned. The more I looked at this, the more confusing it started to look and feel, and I felt it was leaving too much potential for future mistakes. So, while I don't usually love when functions modify an argument in place (Promotion, in this case), updating the promotion mechanisms to get all details from the Promotion argument and modify its status (including Freight collection) in place made everything feel much more straightforward.