[Kde-scm-interest] Proposal: Migrating KDE to Git...orious.org
Jonas Bähr
jonas.baehr at web.de
Fri Jul 3 23:58:33 CEST 2009
Am 03.07.2009 um 16:41 schrieb Jeff Mitchell:
> Chani wrote:
>>> S1) Commitfilter
>>>
>>> Although running arbitrary shellscripts on Gitorious.org as git
>>> hooks is
>>> not allowed for security reasons, Johan is planning to add support
>>> to
>>> POST the data of commits to URLs (it's in a branch that will be
>>> integrated soon). This will allow you to supply one or more callback
>>> URLs for a repository, so whenever someone pushes the details of the
>>> commit are POSTed via HTTP to the callback URL(s) as JSON. It
>>> includes
>>> items like the actual commit, who pushed it, and the before/after
>>> SHAs.
>>>
>>> This could be used (with IP-based access control for security) to
>>> still
>>> be able to provide commitfilter-like functionality (although
>>> commitfilter as it exists would likely need to be updated as a
>>> result of
>>> the SCM difference in the first place).
>>
>> what about BUG:, CCMAIL:, etc?could it provide hooks for that too?
>> I guess whatever server the callback goes to could do anything with
>> the data,
>> right? but someone would have to set up such a server and (re)write
>> all the
>> scripts...
>>
>> so... do we have someone willing and able to do that? I don't know
>> a thing
>> about this web stuff.
>>
>> is there any chance gitorious would be willing to make an exception
>> to this
>> no-scripts rule for KDE? if so, how much work would it be to write
>> *those*
>> scripts? (ie, would it be less work than doing this http hook thing?)
>
> No. But it shouldn't be that much work. Subversion hooks (IIRC) are
> basically get (from the server) the revision number and the contents
> of
> the commit. Adapting them to being POSTed from the web should
> essentially just be changing *where* the data comes from...I don't
> think
> it would actually entail an enormous amount of rewriting of the
> scripts
> themselves (any changes that would have to be done as a result of Git
> would have to happen anyways).
A simple wrapper mapping http post requests to svn hook scripts is a
four-liner (with error/auth handling perhaps a bit more ;-)):
------8<------(START gitorious_svn_hook_brigde.rb)-----8<---------
require "sinatra" # see http://www.sinatrarb.com/
post "/post-commit" do
system "post-commit.sh", param["REPOS"], param["REV"]
end
------8<------(END gitorious_svn_hook_brigde.rb)-----8<---------
Well, gitorious will almost certainly provide other variables as
"REPOS" and "REV", but you get the idea. Using ruby and sinatra it's
*really* easy to make shell scripts accessible via http.
HTH,
Jonas
More information about the Kde-scm-interest
mailing list