Discussion:
Hook script common environment variables
Tom Browder
2018-06-19 23:39:09 UTC
Permalink
The docs mention one can use a common hook environment for multiple repos
but so far I can’t find an example of that or any more details. I have
looked at the example hook.env file but I don’t see any reference to global
env vars.

I know I can have each hook script, say as a bash script, source a global
file but surely there is a more elegant way to set global variables used by
hook scripts.

Thanks for any help.

Best regards,

-Tom
Bo Berglund
2018-06-20 05:46:55 UTC
Permalink
On Tue, 19 Jun 2018 18:39:09 -0500, Tom Browder
Post by Tom Browder
The docs mention one can use a common hook environment for multiple repos
but so far I can’t find an example of that or any more details. I have
looked at the example hook.env file but I don’t see any reference to global
env vars.
http://svnbook.red-bean.com/en/1.8/svn.reposadmin.create.html#svn.reposadmin.hooks.configuration.ex-1

and maybe:
http://svnbook.red-bean.com/en/1.8/svn.advanced.confarea.html
--
Bo Berglund
Developer in Sweden
Stefan Sperling
2018-06-20 08:02:16 UTC
Permalink
Post by Tom Browder
The docs mention one can use a common hook environment for multiple repos
but so far I can’t find an example of that or any more details. I have
looked at the example hook.env file but I don’t see any reference to global
env vars.
It is unclear which type of server are you using.
Apache HTTPD with mod_dav_svn, or svnserve?

For svnserve, you can specify a path in svnserve's config file:
[general]
hooks-env = /path/to/a/global/hooks-env/file

The environment specified in the referenced file will then apply
to all repositories. The referenced file's syntax is shown in the
hook.env example you've alreay found.

For mod_dav_svn there is a similar configuration directive called
SVNHooksEnv which also points to a file.

Could you please point us at the docs you were reading which were
unclear? Maybe they need to be adjusted or updated. Thanks.
Tom Browder
2018-06-20 11:34:26 UTC
Permalink
Post by Stefan Sperling
Post by Tom Browder
The docs mention one can use a common hook environment for multiple repos
but so far I can’t find an example of that or any more details. I have
looked at the example hook.env file but I don’t see any reference to global
env vars.
It is unclear which type of server are you using.
Apache HTTPD with mod_dav_svn, or svnserve?
[general]
hooks-env = /path/to/a/global/hooks-env/file
Okay, that’s part of what I was looking for. I am using svnserve. However,
according to "man svnserve" I am using it not as a daemon but with svn+ssh
so I have to specify the global file explicitly somehow.

But I can add that common path in each repo’s hook-env, that’s clear.
Post by Stefan Sperling
The environment specified in the referenced file will then apply
I think that only applies to the daemon as I read the docs.
Post by Stefan Sperling
to all repositories. The referenced file's syntax is shown in the
hook.env example you've already found.
That referenced example is for an individual repo.

But if it is true for svn+ssh, does one just drop a svnserv.conf file in
directory /etc/subversion.?
Post by Stefan Sperling
Could you please point us at the docs you were reading which were
unclear? Maybe they need to be adjusted or updated. Thanks.
I’ll send doc suggestions after I get a working solution (PRs accepted?).

Thanks, Stefan.

Best regards,

-Tom

Loading...