karasz
(Karasz)
June 14, 2016, 10:06pm
1
Hello,
I have some issues using the git middleware, more specifically the webhook part of it.
I have the source of the site hosted in a gogs instance, my Caddyfile part is as follows:
https://mysite {
gzip
log stdout
errors stderr
tls user@mysite
git {
repo http://someuser:password@git.mysite/www.git
path ../../git/www
hook /webhook
then /usr/bin/builder www
}
root /srv/html/www
}
when starting caddy git pulls and the builder script is launched.
if there is no /webhook file or directory a git push will trigger a POST but caddy will respond with 404
if I create a directory /webhook, git push will trigger a POST but caddy will respond with 404
if I create a file /webhook, git push will trigger a POST and caddy will respond with 200 but neither will do a git pull nor launch the builder script.
Any idea what I am doing wrong? documentation does ot say anything about the existence or not of a physical webhook endpoint.
abiosoft
(Abiola Ibrahim)
June 15, 2016, 5:41am
2
This should not be required but try adding hook_type gogs
to the git config and see if anything changes.
It is preferred to not have a webhook endpoint point to a valid file/directory. I am not sure of the behaviour yet as I have not tested the scenario.
Lastly, enable access log log
and monitor the requests.
karasz
(Karasz)
June 15, 2016, 8:54am
3
Caddyfile:
https… {
gzip
log stdout
errors stderr
tls user@mysite
git {
repo ht…
path …/…/git/www
hook /webhook
hook_type gogs
then /usr/bin/builder www
}
root /srv/html/www
}
log:
2016/06/15 10:22:43 Caddyfile:10 - Parse error: invalid hook type gogs
if I delete the physical endpoint files I get in log:
[15/Jun/2016:10:49:39 +0200] “POST /webhook HTTP/1.1” 404 38
gogs says failure and the response it sees is:
Headers:
Content-Type: text/plain; charset=utf-8
Date: Wed, 15 Jun 2016 08:49:39 GMT
Server: Caddy
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
Body:
404 Not Found
Gogs request was:
Headers:
Request URL: https…webhook
Request method: POST
Content-Type: application/json
X-Gogs-Delivery: e8dbf53c-2ad1-4239-a9a9-9b37780c08b3
X-Gogs-Event: push
Sorry but I had to edit the URLs
abiosoft
(Abiola Ibrahim)
June 15, 2016, 9:33am
4
This should not happen. What version of Caddy are you running ?
karasz
(Karasz)
June 15, 2016, 9:43am
5
caddy --version
Caddy 0.8.3
downloaded from caddyserver.com with git feature
matt
(Matt Holt)
June 15, 2016, 1:40pm
6
I haven’t updated the build server recently since I’ve been working so much on 0.9. Could that be the issue?
abiosoft
(Abiola Ibrahim)
June 15, 2016, 8:54pm
7
The current version works fine too. No similar issues have been reported before.
karasz
(Karasz)
June 16, 2016, 9:43am
8
It seems to me that the git module does not even execute pull hourly. As far as I can see it only pulls at caddy startup.
abiosoft
(Abiola Ibrahim)
June 16, 2016, 11:52am
9
That only works when webhook is not used. Either interval or webhook.
karasz
(Karasz)
June 16, 2016, 12:16pm
10
What seems strange to me is that it errors on hook_type gogs, for that I have no explanation.
abiosoft
(Abiola Ibrahim)
June 16, 2016, 12:30pm
11
Actually, that was mainly introduced as a security measure for generic
hook type. Hook types are auto detected and should work fine.
I added tests here because of your issue and it passed. Mind trying 0.9 beta ?
karasz
(Karasz)
June 16, 2016, 2:37pm
12
Sure I can try 0.9 beta, but on that server I have no go environment, is there somewhere a 0.9 built with git feature for linux amd64?
jacob
(Jacob Hands)
June 16, 2016, 2:47pm
13
Do you have a local Go environment you can build it on? Build server is still on 0.8x
system
(system)
Closed
September 14, 2016, 2:47pm
14
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.