-
Notifications
You must be signed in to change notification settings - Fork 311
fix: use correct default branch in multi-source applications #1056
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: use correct default branch in multi-source applications #1056
Conversation
c97c235
to
616080b
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1056 +/- ##
==========================================
+ Coverage 63.37% 63.63% +0.26%
==========================================
Files 15 15
Lines 2326 2343 +17
==========================================
+ Hits 1474 1491 +17
Misses 760 760
Partials 92 92 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
the e2e test is passing because it's using the default argocd writeback, not the git write-back. I think we can skip e2e test for this issue, and some unit tests should suffice. |
annotations := app.GetAnnotations() | ||
if branch, ok := annotations[common.GitBranchAnnotation]; ok { | ||
return branch | ||
} |
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.
we cannot take the annotation value as is, since it can be a composite form like "main:changes". See https://argocd-image-updater.readthedocs.io/en/latest/basics/update-methods/#specifying-a-branch-to-commit-to
I guess we dont' see the above block. Line 200 already handles this case. See next comment.
checkOutBranch := getWriteBackBranch(app) | ||
if wbc.GitBranch != "" { | ||
checkOutBranch = wbc.GitBranch | ||
} |
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.
if the gitbranch is set, we always take it. So I think we only need to call the func getWriteBackBranch
if wbc.GitBranch is empty (in the else clause).
Signed-off-by: Atif Ali <atali@redhat.com>
…sts && enhance unit tests Signed-off-by: Atif Ali <atali@redhat.com>
Signed-off-by: Atif Ali <atali@redhat.com>
ef95659
to
101af51
Compare
Signed-off-by: Atif Ali <atali@redhat.com>
This PR fixes: #932