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 API raw requests for commits and tags #2841

Merged

Conversation

lafriks
Copy link
Member

@lafriks lafriks commented Nov 3, 2017

Fixes #2824

Replaces #2836

lflare and others added 2 commits November 3, 2017 10:35
This particular part of the code was broken due to 513375c when the default was set to branch name instead of commit references
@lafriks lafriks added this to the 1.3.0 milestone Nov 3, 2017
@lafriks lafriks changed the title Fixes API raw requests for commits and tags Fix API raw requests for commits and tags Nov 3, 2017
@codecov-io
Copy link

codecov-io commented Nov 3, 2017

Codecov Report

Merging #2841 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2841   +/-   ##
=======================================
  Coverage   26.85%   26.85%           
=======================================
  Files          89       89           
  Lines       17607    17607           
=======================================
  Hits         4728     4728           
  Misses      12193    12193           
  Partials      686      686

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 e6bb8e7...58c127e. Read the comment docs.

@tboerger tboerger added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Nov 3, 2017
@@ -497,6 +500,8 @@ func getRefNameFromPath(ctx *Context, path string, isExist func(string) bool) st
func getRefName(ctx *Context, pathType RepoRefType) string {
path := ctx.Params("*")
switch pathType {
case RepoRefAPI:
fallthrough
Copy link
Member

Choose a reason for hiding this comment

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

Is not this same as case RepoRefLegacy, RepoRefAPI:? That means you don't need RepoRefAPI.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, you do; see line 623

Copy link
Member

Choose a reason for hiding this comment

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

@ethantkoenig Thx, got it. case RepoRefLegacy, RepoRefAPI: can be used anyway.

@appleboy
Copy link
Member

appleboy commented Nov 3, 2017

Still failed in push tag event.

ERRO[0095] error: fullinn/back: cannot find .drone.yml in refs/tags/0.0.10: 404 Not Found
ERRO[0095] Error #01: 404 Not Found
                     ip=139.162.127.189 latency=28.606842ms method=POST path=/hook status=404 time=2017-11-03T14:36:50Z user-agent=GogsServer

@@ -466,6 +466,9 @@ const (
// RepoRefLegacy unknown type, make educated guess and redirect.
// for backward compatibility with previous URL scheme
RepoRefLegacy RepoRefType = iota
// RepoRefAPI is for usage in API where educated guess is needed
// but redirect can not be made
RepoRefAPI
Copy link
Member

Choose a reason for hiding this comment

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

nit: rename to make behavior more obvious, perhaps RepoRefAny?

@lafriks
Copy link
Member Author

lafriks commented Nov 3, 2017

@Morlinest @ethantkoenig fixed your recommendations

@Morlinest
Copy link
Member

LGTM

@tboerger tboerger added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Nov 3, 2017
@ethantkoenig
Copy link
Member

LGTM

@tboerger tboerger added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Nov 3, 2017
@lafriks
Copy link
Member Author

lafriks commented Nov 3, 2017

@appleboy it does work for me (at least when accessing API directly). Added also tests that show that

@lafriks
Copy link
Member Author

lafriks commented Nov 3, 2017

@appleboy can you please verify from logs that api/raw url is what is failing?

@lafriks lafriks merged commit 08b124d into go-gitea:master Nov 3, 2017
@lafriks lafriks deleted the LFlare-fix/2824_drone-webhook-fix branch November 3, 2017 23:24
@appleboy
Copy link
Member

appleboy commented Nov 4, 2017

@lafriks Still not working in Tag event.

@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integration between drone and Gitea (bleeding edge) erroring out on webhook
7 participants