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 out-of-bounds error when a push doesn't contain commits #2434

Merged
merged 1 commit into from
Oct 17, 2018

Conversation

typeless
Copy link

This happens when I push a new tag with git tag -af foo -m "bar" && git push --tags. Both the 'create' and 'push' events are triggered.
The log of the drone server would show an internal panic like the following:

2018/06/11 08:34:56 [Recovery] panic recovered:
POST /hook?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZXh0IjoibXVyYS9OVFREQVRBLXBsdWdpbiIsInR5cGUiOiJob29rIn0.IDq3cvR1LNHTvtrWWrmqW4GfyterT8B4tKS_MDUFBMQ HTTP/1.1
Host: 192.120.100.224
Accept-Encoding: gzip
Content-Length: 2902
Content-Type: application/json
User-Agent: GiteaServer
X-Gitea-Delivery: ad3bd9f2-571d-4dac-91d7-ec6b63baf5e7
X-Gitea-Event: push
X-Github-Delivery: ad3bd9f2-571d-4dac-91d7-ec6b63baf5e7
X-Github-Event: push
X-Gogs-Delivery: ad3bd9f2-571d-4dac-91d7-ec6b63baf5e7
X-Gogs-Event: push


runtime error: index out of range
/usr/local/go/src/runtime/panic.go:489 (0x430c7f)
/usr/local/go/src/runtime/panic.go:28 (0x42f8fe)
/go/src/github.com/drone/drone/remote/gitea/helper.go:91 (0xa1cf2f)
/go/src/github.com/drone/drone/remote/gitea/parse.go:72 (0xa1e61b)
/go/src/github.com/drone/drone/remote/gitea/parse.go:44 (0xa1e471)
/go/src/github.com/drone/drone/remote/gitea/gitea.go:338 (0xa1c4db)
/go/src/github.com/drone/drone/server/hook.go:72 (0x932cd4)
/go/src/github.com/drone/drone/vendor/github.com/gin-gonic/gin/context.go:97 (0x88800a)
/go/src/github.com/drone/drone/router/middleware/token/token.go:31 (0x8a1620)
/go/src/github.com/drone/drone/vendor/github.com/gin-gonic/gin/context.go:97 (0x88800a)
/go/src/github.com/drone/drone/router/middleware/session/user.go:82 (0x8a0ac2)
/go/src/github.com/drone/drone/vendor/github.com/gin-gonic/gin/context.go:97 (0x88800a)
/go/src/github.com/drone/drone/router/middleware/store.go:29 (0x9a0fa7)
/go/src/github.com/drone/drone/vendor/github.com/gin-gonic/gin/context.go:97 (0x88800a)
/go/src/github.com/drone/drone/vendor/github.com/gin-gonic/contrib/ginrus/ginrus.go:26 (0x9a13ff)
/go/src/github.com/drone/drone/vendor/github.com/gin-gonic/gin/context.go:97 (0x88800a)
/go/src/github.com/drone/drone/router/middleware/header/header.go:39 (0x898630)
/go/src/github.com/drone/drone/vendor/github.com/gin-gonic/gin/context.go:97 (0x88800a)
/go/src/github.com/drone/drone/router/middleware/header/header.go:31 (0x8985d9)
/go/src/github.com/drone/drone/vendor/github.com/gin-gonic/gin/context.go:97 (0x88800a)
/go/src/github.com/drone/drone/vendor/github.com/gin-gonic/gin/recovery.go:45 (0x89629a)
/go/src/github.com/drone/drone/vendor/github.com/gin-gonic/gin/context.go:97 (0x88800a)
/go/src/github.com/drone/drone/vendor/github.com/gin-gonic/gin/gin.go:284 (0x88de40)
/go/src/github.com/drone/drone/vendor/github.com/gin-gonic/gin/gin.go:265 (0x88d75b)
/usr/local/go/src/net/http/server.go:2568 (0x6cc862)
/usr/local/go/src/net/http/server.go:1825 (0x6c8a02)
/usr/local/go/src/runtime/asm_amd64.s:2197 (0x45f881)

@CLAassistant
Copy link

CLAassistant commented Jun 11, 2018

CLA assistant check
All committers have signed the CLA.

@typeless
Copy link
Author

I tried to test this on my local machine. I put cmd/drone-server/drone-server and cmd/drone-agent/drone-agent into release/ and ran the Dockerfiles but it didn't work, not event started correctly.

Any pointers?

@tibkiss
Copy link

tibkiss commented Jun 20, 2018

Hitting the same issue.
I'm not sure how to bring up the build, but extending the helper_tests.go with a testcase might be helpful to avoid regression in the future.

@tboerger
Copy link

https://github.com/drone/drone/blob/master/.drone.sh pretty clear shows how Drone gets built.

@tibkiss
Copy link

tibkiss commented Aug 27, 2018

@tboerger : what would be the acceptance criteria to merge this issue? I'd love to see this in a new release as it blocks tag based builds using gitea.

@typeless
Copy link
Author

@tboerger @tibkiss I am sorry I ignored @tboerger 's comment which was buried in the notifications. However, my problem was about creating the docker images rather than building the executables. Anyway, I had moved on and lost the dev setup so I am reluctant to proceed the testing. The fix is trivial so if anyone would like to proceed or submit a new PR by yourself I would appreciate.

@tboerger
Copy link

@bradrydzewski is this already covered by the new scm lib?

@bradrydzewski
Copy link

bradrydzewski commented Oct 16, 2018

@tboerger nope, looks like it needs to be fixed in go-scm for pull requests. The relevant code can be found here:

https://github.com/drone/go-scm/blob/master/scm/driver/gitea/webhook.go#L197:L209

This pull request was closed.
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.

5 participants