From a09604d9b20cf560ffc60db1997e328dbac5d768 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Tue, 17 Apr 2018 12:13:22 +0200 Subject: [PATCH] Add a custom post-receive-chained hook for forks This hook doesn't send fedmsg messages on the git.receive topic and does not notify the alternative arch folks about changes Signed-off-by: Pierre-Yves Chibon --- .../hooks/files/post-receive-chained-forks | 34 +++++++++++++++++++ roles/git/hooks/tasks/main.yml | 1 + 2 files changed, 35 insertions(+) create mode 100755 roles/git/hooks/files/post-receive-chained-forks diff --git a/roles/git/hooks/files/post-receive-chained-forks b/roles/git/hooks/files/post-receive-chained-forks new file mode 100755 index 0000000000..6f0fd88deb --- /dev/null +++ b/roles/git/hooks/files/post-receive-chained-forks @@ -0,0 +1,34 @@ +#!/bin/bash +# Redirect stdin to each of the post-receive hooks in place. + +# You need to explicitly add your hook to the following list +# for it to be invoked. +pee \ + /usr/lib/python2.7/site-packages/pagure/hooks/files/default_hook.py \ + /usr/lib/python2.7/site-packages/pagure/hooks/files/pagure_hook.py \ + "/usr/bin/grok-manifest -m /srv/git/grokmirror/manifest.js.gz -t /srv/git/repositories/ -n `pwd`" + +# We used to send emails directly from the git hook here, but now we send to +# fedmsg which routes to FMN which routes to packagers and the mailing list. +#$GIT_DIR/hooks/post-receive-chained.d/post-receive-email \ + +# Mechanism to support pagure's hook as well +hookname=`basename $0` + + +FILE=`mktemp` +trap 'rm -f $FILE' EXIT +cat - > $FILE + +for hook in $GIT_DIR/hooks/$hookname.* +do + if test -x "$hook"; then + cat $FILE | $hook "$@" + status=$? + + if test $status -ne 0; then + echo Hook $hook failed with error code $status + exit $status + fi + fi +done diff --git a/roles/git/hooks/tasks/main.yml b/roles/git/hooks/tasks/main.yml index 869dc07482..bfb2dd0fa1 100644 --- a/roles/git/hooks/tasks/main.yml +++ b/roles/git/hooks/tasks/main.yml @@ -26,6 +26,7 @@ with_items: - post-receive-fedmsg - post-receive-chained + - post-receive-chained-forks - post-receive-alternativearch - update-block-push-origin tags: