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

View better error if repo was deleted/renamed #780

Merged
merged 3 commits into from
Feb 24, 2022

Conversation

qwerty287
Copy link
Contributor

If the repo was renamed, there's an issue with Gitea: it redirects the /api/v1/repos/<owner>/<repo>/hooks POST request to a GET request at the same URL (returns a 302 Found which always redirects to GET - it should return a 307 or woodpecker needs to request again with the correct repo).
This URL returns the list of all hooks, thus the Gitea SDK can't parse the response into a single gitea.Hook type. The PR includes a workaround for this case.

A better error is also visisble if the repo was deleted.

Closes #726

If the repo was renamed, there's an issue with Gitea: it redirects the /api/v1/repos/<owner>/<repo>/hooks POST request to a GET request at the same URL.
This URL returns the list of all hooks, thus the Gitea SDK can't parse the response into a single gitea.Hook type.

A better error is also visisble if the repo was deleted.

Closes woodpecker-ci#726
@6543 6543 added server forge/gitea gitea forge related enhancement improve existing features labels Feb 21, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #780 (11b6d25) into master (c4960cd) will decrease coverage by 0.07%.
The diff coverage is 18.18%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #780      +/-   ##
==========================================
- Coverage   52.22%   52.14%   -0.08%     
==========================================
  Files          86       86              
  Lines        5944     5953       +9     
==========================================
  Hits         3104     3104              
- Misses       2668     2676       +8     
- Partials      172      173       +1     
Impacted Files Coverage Δ
server/remote/gitea/gitea.go 38.70% <18.18%> (-1.16%) ⬇️

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 c4960cd...11b6d25. Read the comment docs.

@6543 6543 added this to the 0.15.0 milestone Feb 24, 2022
@6543 6543 merged commit 28e96a3 into woodpecker-ci:master Feb 24, 2022
@qwerty287 qwerty287 deleted the rm-repo-error branch February 26, 2022 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement improve existing features forge/gitea gitea forge related server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable non existing / renamed repo fail with useless error
4 participants