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: Bob Proulx
Subject: Re: [Savannah-hackers-public] Install a post-receive hook in the GNU Emacs repository
Date: Tue, 12 Jul 2022 15:26:00 -0600

Gregory Heytings wrote:
> We're in the process of installing a CI system for GNU Emacs.
>
> Could you please add the following post-receive hook in the Emacs
> repository?

Sure.  Done.

> #!/bin/bash
> while read line; do lines="${lines}${line};;"; done
> { timeout -s 9 -k 5 10 wget -q -O- --post-data "$lines" 
> https://emacs-ci.heytings.org/ ; } &> /dev/null
>
> 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.  This needed adapting.

I moved the existing git-multimail hook to a new name.

    mv post-receive post-receive-git_multimail-emacs

Then installed this script to drive multiple hooks.

    #!/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

    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.

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/
    drwxrwsr-x          4,096 2022/07/12 15:08:11 .
    -rwxrwxr-x            452 2014/11/12 14:56:01 applypatch-msg.sample
    -rwxrwxr-x            896 2014/11/12 14:55:59 commit-msg.sample
    -rwxr-xr-x         91,100 2014/12/01 00:48:54 git_multimail.py
    -rwxr-xr-x         90,557 2014/11/25 01:10:36 git_multimail.py.20141125
    -rwxr-xr-x         90,808 2014/11/25 17:12:29 git_multimail.py.20141127
    -rwxr-xr-x         90,768 2014/11/18 00:52:40 git_multimail.py.ORIG
    -rwxrwxr-x            160 2014/11/12 14:55:59 post-commit.sample
    -rwxr-xr-x            350 2022/07/12 15:08:11 post-receive
    -rw-r--r--            328 2022/07/12 15:08:09 post-receive-ci.heytings.org
    -rwxr-xr-x          1,677 2017/01/30 17:27:41 
post-receive-git_multimail-emacs
    -rwxr-xr-x          1,567 2014/11/13 14:28:01 post-receive.20141116
    -rwxr-xr-x          1,523 2014/11/18 00:25:37 post-receive.20141117
    -rwxr-xr-x          1,682 2014/11/18 10:16:42 post-receive.20141125
    -rwxrwxr-x            552 2014/11/12 14:56:02 post-receive.sample
    -rwxr-xr-x             38 2014/11/12 14:56:38 post-update
    -rwxrwxr-x            189 2014/11/12 14:56:03 post-update.sample
    -rwxrwxr-x            398 2014/11/12 14:56:00 pre-applypatch.sample
    -rwxrwxr-x          1,578 2014/11/12 14:55:31 pre-commit.sample
    -rwxrwxr-x          4,951 2014/11/12 14:56:03 pre-rebase.sample
    -rwxrwxr-x          1,239 2014/11/12 14:56:05 prepare-commit-msg.sample
    -rwxrwxr-x          3,611 2014/11/12 14:56:04 update.sample

Bob



reply via email to

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