Skip to content
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: throw better error if default branch is missing in gitea #9228

Conversation

crenshaw-dev
Copy link
Collaborator

A gitea unit test is failing because the gitea API is returning main as the default branch for https://gitea.com/gitea/test-openldap when the only existing branch is master.

I've modified the "get branch" logic to fall back to the only branch if the default branch is missing.

Signed-off-by: Michael Crenshaw <michael@crenshaw.dev>
@crenshaw-dev
Copy link
Collaborator Author

@rishabh625 here's the alternative fix for the unit test failure.

@codecov
Copy link

codecov bot commented Apr 27, 2022

Codecov Report

Merging #9228 (9963bcf) into master (b760a27) will increase coverage by 0.26%.
The diff coverage is 37.50%.

@@            Coverage Diff             @@
##           master    #9228      +/-   ##
==========================================
+ Coverage   45.53%   45.79%   +0.26%     
==========================================
  Files         219      219              
  Lines       25897    25864      -33     
==========================================
+ Hits        11792    11845      +53     
+ Misses      12463    12373      -90     
- Partials     1642     1646       +4     
Impacted Files Coverage Δ
cmd/argocd/commands/app.go 14.99% <ø> (+2.65%) ⬆️
cmd/argocd/commands/repo.go 0.00% <0.00%> (ø)
util/argo/argo.go 66.57% <ø> (+3.45%) ⬆️
util/cmp/stream.go 52.14% <ø> (+1.09%) ⬆️
util/gpg/gpg.go 68.20% <ø> (+0.20%) ⬆️
util/jwt/jwt.go 63.93% <ø> (+3.93%) ⬆️
util/util.go 66.66% <ø> (+41.66%) ⬆️
applicationset/services/scm_provider/gitea.go 74.11% <33.33%> (-3.00%) ⬇️
server/server.go 54.23% <100.00%> (+0.15%) ⬆️
applicationset/services/scm_provider/github.go 75.29% <0.00%> (-5.89%) ⬇️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 530b007...9963bcf. Read the comment docs.

Copy link
Member

@terrytangyuan terrytangyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Michael Crenshaw <michael@crenshaw.dev>
Copy link
Collaborator

@leoluz leoluz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@rishabh625 rishabh625 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM , but I want ci to be successful before merge

@crenshaw-dev crenshaw-dev enabled auto-merge (squash) April 27, 2022 16:15
@crenshaw-dev crenshaw-dev changed the title fix: fall back to only branch if default branch is missing in gitea fix: throw better error if default branch is missing in gitea Apr 27, 2022
@crenshaw-dev crenshaw-dev merged commit 5f0e58d into argoproj:master Apr 27, 2022
@crenshaw-dev crenshaw-dev deleted the gitea-missing-default-branch-fallback branch April 27, 2022 17:29
crenshaw-dev added a commit to josephmcasey/argo-cd that referenced this pull request Apr 27, 2022
…rgoproj#9228)

* fix: fall back to only branch if default branch is missing in gitea

Signed-off-by: Michael Crenshaw <michael@crenshaw.dev>

* throw meaningful error, use different org for test

Signed-off-by: Michael Crenshaw <michael@crenshaw.dev>
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.

None yet

4 participants