inheriting enviroment variables by hooks

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

inheriting enviroment variables by hooks

Marcin Kuzminski
Hi,

We're trying to build a generic integration system for RhodeCode that would also support Subversion. The problem we're now having is how to transmit some data during e.g commit operation from our system into running hooks. 
Our idea now is to use apache and set some special HTTP headers, and Enviroment variables when using the HTTP protocol. 

However after reading some threads, it seems that when subversion executes hooks it clears the enviroment variables. Is there ANY way to inherit some env set by apache?

Cheers
Reply | Threaded
Open this post in threaded view
|

Re: inheriting enviroment variables by hooks

Johan Corveleyn-3
On Wed, Nov 22, 2017 at 1:36 PM,  <[hidden email]> wrote:

> Hi,
>
> We're trying to build a generic integration system for RhodeCode that would
> also support Subversion. The problem we're now having is how to transmit
> some data during e.g commit operation from our system into running hooks.
> Our idea now is to use apache and set some special HTTP headers, and
> Enviroment variables when using the HTTP protocol.
>
> However after reading some threads, it seems that when subversion executes
> hooks it clears the enviroment variables. Is there ANY way to inherit some
> env set by apache?

I don't know if this is what you're looking for, but as of 1.8 there
is the mod_dav_svn directive SVNHooksEnv.

The svn book [1] contains the following description:
"Specifies the location of the Subversion repository hook script
environment configuration file. This file is used to describe the
initial environment in which repository hook scripts are executed. For
more on this feature, see the section called 'Hook script environment
configuration'." [2]

[1] http://svnbook.red-bean.com/nightly/en/svn.serverconfig.httpd.html#svn.serverconfig.httpd.ref.mod_dav_svn
[2] http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html#svn.reposadmin.hooks.configuration

--
Johan
Reply | Threaded
Open this post in threaded view
|

Re: inheriting enviroment variables by hooks

Marcin Kuzminski
Hi Johan,

I didn't know about that setting thanks for the pointer. 

However It looks like it's a way to set an alternative path to the hooks-env file. Which is global per repository. What we're trying to solve is to have a dynamic env that would inherit some variables per request. e.g IP address of client who is doing svn commit. There are bunch of stuff we'd like to pass along.

Cheers


On Thu, Nov 23, 2017 at 15:45, Johan Corveleyn <[hidden email]> wrote:
On Wed, Nov 22, 2017 at 1:36 PM, <[hidden email]> wrote:

> Hi,
>
> We're trying to build a generic integration system for RhodeCode that would
> also support Subversion. The problem we're now having is how to transmit
> some data during e.g commit operation from our system into running hooks.
> Our idea now is to use apache and set some special HTTP headers, and
> Enviroment variables when using the HTTP protocol.
>
> However after reading some threads, it seems that when subversion executes
> hooks it clears the enviroment variables. Is there ANY way to inherit some
> env set by apache?

I don't know if this is what you're looking for, but as of 1.8 there
is the mod_dav_svn directive SVNHooksEnv.

The svn book [1] contains the following description:
"Specifies the location of the Subversion repository hook script
environment configuration file. This file is used to describe the
initial environment in which repository hook scripts are executed. For
more on this feature, see the section called 'Hook script environment
configuration'." [2]

[1] http://svnbook.red-bean.com/nightly/en/svn.serverconfig.httpd.html#svn.serverconfig.httpd.ref.mod_dav_svn
[2] http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html#svn.reposadmin.hooks.configuration

--
Johan
Reply | Threaded
Open this post in threaded view
|

Re: inheriting enviroment variables by hooks

Johan Corveleyn-3
On Thu, Nov 23, 2017 at 4:12 PM, <[hidden email]> wrote:
>
> Hi Johan,
>
> I didn't know about that setting thanks for the pointer.
>
> However It looks like it's a way to set an alternative path to the hooks-env file. Which is global per repository. What we're trying to solve is to have a dynamic env that would inherit some variables per request. e.g IP address of client who is doing svn commit. There are bunch of stuff we'd like to pass along.

It seems that's not possible currently (I've checked with some other
devs on #svn-dev on freenode IRC). There are some httpd modules that
support injecting "environment variables" (in the httpd definition of
that term [1]), but mod_dav_svn doesn't. If you need this, this would
have to be discussed / developed as a new feature, I believe. If
you're interested in that, you're very welcome to drive such a feature
(starting by discussing what it should look / behave like). We're
always looking for new contributors ;-).

One other suggestion that came from Stefan Sperling on IRC was:
"ephemeral properties". These are some properties that are
automatically injected by mod_dav_svn as special properties in a
transaction, available in the pre-commit hook, but automatically
removed when the transaction gets promoted to a revision. Currently
there are two such properties:

    svn:txn-client-compat-version
    svn:txn-user-agent

See svn_props.h [2].
But I'm guessing those two existing properties are not sufficient for you.

[1] http://httpd.apache.org/docs/current/env.html
[2] http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_props.h?revision=1718912&view=markup#l685

--
Johan
Reply | Threaded
Open this post in threaded view
|

Re: inheriting enviroment variables by hooks

Julian Foad-4
Johan Corveleyn wrote:
> It seems that's not possible currently (I've checked with some other
> devs on #svn-dev on freenode IRC).

Marcin, please do join us on the IRC channel if you want to have a 'high
bandwidth' chat about this -- maybe more ideas will come from chatting.

(Nowadays I recommend connecting through Matrix using
<a href="https://riot.im/app/#/room/#freenode_#svn-dev:matrix.org">https://riot.im/app/#/room/#freenode_#svn-dev:matrix.org if you don't
have a preferred IRC client.)

- Julian