Does Gitorious have hooks for CIA commit notification?
Asked Answered
C

5

8

As I am running out of my space on GitHub on my free account (yes, I am considering upgrading), I am setting up new git repositories on Gitorious (see also GitHub vs Gitorious). One great feature of GitHub is the post-commit hooks, that allow me to notify the (also great) CIA network...

However, I have been unable to find if Gitorious supports such hooks... So, I'd like to ask best practices for getting commit messages show up on the CIA network for Gitorious-hosted git repositories.

Update: the solution of using a secondary mechanism to trigger CIA commit messages is not what I am looking for.

Comprehend answered 16/12, 2009 at 10:26 Comment(2)
Also found it asked on a google group, but without answer: groups.google.com/group/gitorious/browse_thread/thread/…Comprehend
KDE is also struggling with the same questions, and seemed to have made a custom solution: techbase.kde.org/Projects/MovetoGit#Post_Update_hooksComprehend
G
2

Instead of pushing straight to Gitorious, push to a local repository that you've configured (in its post-receive hook) to both push everything to your Gitorious repository and notify CIA.

Gelid answered 6/3, 2010 at 11:30 Comment(2)
How would I configure that local repository?Comprehend
Put your CIA notification in the update hook (@maxy put a link: cia.vc/clients/git/ciabot.bash). In the post-update hook, put a "git push --mirror Gitorious/url" (or git push --all, whichever is more appropriate)Gelid
D
5

Gitorious is getting web hook support. It is currently running on gitorious.org, but without a UI for adding them to your repository; the reason for this is that there still may be a change or two to the JSON representation of the commit data exposed, so it should be configured a beta feature.

Anyone feeling up to writing integration code (handling gitorious' web hook requests), please send an email to support at gitorious.org and we'll set up the integration for your repository

Deity answered 8/3, 2010 at 7:35 Comment(3)
Could you please add some URLs to further info on this hook support?Comprehend
An example (and history) of the JSON payload generated is at postbin.org/wqpx3lDeity
That was March, 2010. It's now 2012, and I still don't see such a feature!Deflation
G
3

The KDE project had a similar question in that thread, with an interesting alternative:

It doesn't have to be running on gitorious.org machines. At least, not for email/CIA/RSS/whatever reporting

That's how our old git-p4 hook worked in the office:
the p4 machine sent out a UDP packet with the revision number. Another machine caught it and did the import. (the value was discarded)

We could do the same:

  • the gitorious.org machine sends a UDP packet with the branches that changed and their new SHA-1.
  • Another machine fetches and produces the commit logs.
    Worst case scenario is that someone is forgotten due to a dropped UDP packet.

Like I said, this works for reporting -- for anything that is run by a post-receive hook.
For anything requiring a pre-receive hook (actually, pre-update, but the name is wrong in Git), it will have to be run on their servers.

Ganley answered 5/3, 2010 at 15:31 Comment(2)
Who is 'you' in your comment?Comprehend
@Egon: sorry, that was a first incorrect edit in my initial answer. I meant the KDE project.Ganley
S
2

My current workaround is to set up a loal repository (called CIA) and always push via a tiny shell script:

#!/bin/bash
set -e
git push origin master
git push cia master

In the local CIA repository I installed http://cia.vc/clients/git/ciabot.bash to send emails to the CIA.

Stagey answered 20/12, 2009 at 16:46 Comment(2)
I guess the first push should be a pull?Comprehend
no, I always push the same commits to two different repository, the gitorious one (origin) which is where I want my code, and my local one (CIA) that will send the emails when I pushStagey
G
2

Instead of pushing straight to Gitorious, push to a local repository that you've configured (in its post-receive hook) to both push everything to your Gitorious repository and notify CIA.

Gelid answered 6/3, 2010 at 11:30 Comment(2)
How would I configure that local repository?Comprehend
Put your CIA notification in the update hook (@maxy put a link: cia.vc/clients/git/ciabot.bash). In the post-update hook, put a "git push --mirror Gitorious/url" (or git push --all, whichever is more appropriate)Gelid
I
1

Gitorious supports "Web Hooks": http://gitorious.org/gitorious/pages/WebHooks

It's a bit more effort, as it requires you to have a web server set up to receive the hook API calls.

Impressive answered 14/12, 2011 at 16:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.