savannah-hackers-public
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Savannah-hackers-public] Install a post-receive hook in the GNU Ema


From: Gregory Heytings
Subject: Re: [Savannah-hackers-public] Install a post-receive hook in the GNU Emacs repository
Date: Tue, 12 Jul 2022 23:29:38 +0000


Could you please add the following post-receive hook in the Emacs repository?

Sure.  Done.


Thanks!

Of course, if the Emacs repository already contains a post-receive hook, it might be necessary to adapt the above lines.

Of course there is already a post-receive hook that sends out commit diffs for emacs.


Indeed, that's what I thought, but I wasn't sure that post-receive was used to send emails.


while read oldrev newrev refname; do
  echo $oldrev $newrev $refname | hooks/post-receive-git_multimail-emacs
  echo $oldrev $newrev $refname | hooks/post-receive-ci.heytings.org
done

I installed this hook script to trigger the CI build. We don't like discarding errors to /dev/null though. And there was no need to depend upon the heavier bash process so I lightened things up somewhat and converted it to portable idiomatic form. Also the git server is often a very loaded system. Short timeouts can be counter productive. I lengthened them somewhat to account for this.

#!/bin/sh

# 2022-07-12 -- rwp
# CI Build hook requested by Gregory Heytings.
# 
https://lists.gnu.org/archive/html/savannah-hackers-public/2022-07/msg00001.html

lines=""
while IFS= read -r line; do
  lines="${lines}${line};;"
done

timeout --kill-after=30s 60s wget -q -O/dev/null --post-data "$lines" 
https://emacs-ci.heytings.org/

Let me know if I missed getting something right. It isn't trivial to test these other than by live action use.


That looks good, except for two things:

(1) the hooks/post-receive-ci.heytings.org must be made executable, and

(2) given that only one oldrev/newrev/refname triplet is passed to the script, the script can be simplified into:

#!/bin/sh
read line
timeout --kill-after=30s 60s wget -q -O/dev/null --post-data "$line" 
https://emacs-ci.heytings.org/


Note that one can always see the current state of the hooks directory for any of the hosted projects. Here is the current emacs state, which has gathered up some significant lint over the years.

$ rsync git.savannah.gnu.org::git/emacs.git/hooks/


Thanks, I didn't know that.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]