savannah-hackers
[Top][All Lists]
Advanced

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

[sr #110939] Adding push hook for Guix


From: Bob Proulx
Subject: [sr #110939] Adding push hook for Guix
Date: Wed, 4 Oct 2023 12:40:27 -0400 (EDT)

Update of sr #110939 (project administration):

                  Status:                    None => Done                   
             Assigned to:                    None => rwp                    
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #1:

Adding git hooks is no problem at all.  But...

> wget --post-data="" -O/dev/null 
https://ci.guix.gnu.org/jobset/$BRANCH/hook/evaluate

I must ask, What will be the value for $BRANCH?  And I am sure you are
thinking, It's the currently pushed branch of course what a silly
question. :-) But as we know git's post-receive hook receives the
oldrev newrev ref hashes written to it on stdin and that's the direct
information we have available to us at that time.  At one time git
used to ship with a sample that included this next bit of text.


The "post-receive" script is run after receive-pack has accepted a pack
and the repository has been updated.  It is passed arguments in through
stdin in the form
 <oldrev> <newrev> <refname>
For example:
 aa453216d1b3e49e7f6f98441fa56946ddcd6a20
68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master


The above came from the sample.  By that I conclude that the refname
will be the $BRANCH that you want to see at that time.  Will that
include the refs/heads part?  Probably not since you show it in the
URL.  I will strip that from the name.  With that interpretation I
have implemented the following hooks.


File post-receive hook, which duplicates stdin to the others.
#!/bin/sh
lines=$(cat)
printf "%s\n" "$lines" | ./hooks/post-receive-git_multimail-emacs
printf "%s\n" "$lines" | ./hooks/post-receive-ci.guix.gnu.org




File post-receive-ci.guix.gnu.org called from above.
#!/bin/sh
wget --post-data="" -O/dev/null 
https://ci.guix.gnu.org/jobset/guix/hook/evaluate
while read oldrev newrev ref; do
    branch=$(basename $ref)
    wget --post-data="" -O/dev/null 
https://ci.guix.gnu.org/jobset/$branch/hook/evaluate
done


Almost certainly something will need tweaking.  Let me know.



    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/support/?110939>

_______________________________________________
Message sent via Savannah
https://savannah.nongnu.org/




reply via email to

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