You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The way gitea runs hooks is broken in multiple ways.
First, as with gitea 1.1.0, the files in pre-receive.d, post-receive.d and update.dmust be sh scripts (not even bash) as they are invoked using sh $filename. You cannot put binaries or even python scripts into these folders as sh cannot interpret them.
Next, no data is passed to the scripts in post-receive.d. So the scripts won't know about branches, revisions, you name it.
Possible fix - works as pre-receive, post-receive and update:
Please note that the scripts in {{pre,post}-receive,update}.d must have the executable bit set in order to run. So when adding custom hooks using gitea's webinterface gitea is required to set that bit.
Also note that the script above requires bash. If you want to have it shell-agnostic (well, at least sh-agnostic) we'll probably have to rewrite the exitcodes-array-stuff.
The text was updated successfully, but these errors were encountered:
…t and options hooks (#1376)
* issue #1250, replace {pre,post}-receive and update hooks with a single shell script that does not require custom hooks to be a sh-script
* issue #1250, make script posix compilant
* v23, add migration script to update {pre,post}-receive and update hooks
* migration: use a more common name and rename v23 to v26 to avoid conflicts
* gofmt'ed and added copyright header
* fix SyncRepositoryHooks to also sync wiki repos
* no migration for you.
[x]
):Description
The way gitea runs hooks is broken in multiple ways.
First, as with gitea 1.1.0, the files in
pre-receive.d
,post-receive.d
andupdate.d
must besh
scripts (not evenbash
) as they are invoked usingsh $filename
. You cannot put binaries or even python scripts into these folders assh
cannot interpret them.Next, no data is passed to the scripts in
post-receive.d
. So the scripts won't know about branches, revisions, you name it.Possible fix - works as
pre-receive
,post-receive
andupdate
:Please note that the scripts in
{{pre,post}-receive,update}.d
must have the executable bit set in order to run. So when adding custom hooks using gitea's webinterface gitea is required to set that bit.Also note that the script above requires
bash
. If you want to have it shell-agnostic (well, at least sh-agnostic) we'll probably have to rewrite theexitcodes
-array-stuff.The text was updated successfully, but these errors were encountered: