Skip to content

Conversation

aali309
Copy link
Contributor

@aali309 aali309 commented Mar 5, 2025

This PR fixes: #932

@codecov-commenter
Copy link

codecov-commenter commented Mar 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.63%. Comparing base (c0ccf02) to head (413a482).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chengfang
Copy link
Collaborator

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.

@aali309 aali309 requested a review from chengfang March 6, 2025 21:15
annotations := app.GetAnnotations()
if branch, ok := annotations[common.GitBranchAnnotation]; ok {
return branch
}
Copy link
Collaborator

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
}
Copy link
Collaborator

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).

aali309 added 3 commits March 7, 2025 12:23
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>
@aali309 aali309 force-pushed the Wrong-default-write-branch branch from ef95659 to 101af51 Compare March 7, 2025 17:23
Signed-off-by: Atif Ali <atali@redhat.com>
@chengfang chengfang merged commit 205fe73 into argoproj-labs:master Mar 11, 2025
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong default write branch is used in multi-source app
3 participants