Use the gitolite Alias feature in staging.

This commit is contained in:
Ralph Bean 2015-12-22 17:37:06 +00:00
parent a9f1d0ca6f
commit b581e4a6f9
4 changed files with 42 additions and 1 deletions

View file

@ -0,0 +1,8 @@
package RepoAliases;
use Exporter;
our @ISA= qw( Exporter );
our @EXPORT_OK = qw( repo_aliases );
sub repo_aliases {
return {
# Content auto-generated by genacls.sh...

View file

@ -149,6 +149,9 @@
- config
- distgit
- name: Copy in RepoAliases.header
copy: src=RepoAliases.header dest=/etc/gitolite/RepoAliases.header owner=root group=root mode=0755
- name: Create the update-block-push-origin symlink
command: ln -s /usr/share/git-core/update-block-push-origin /etc/gitolite/local/VREF/update-block-push-origin
creates=/etc/gitolite/local/VREF/update-block-push-origin

View file

@ -10,8 +10,24 @@ cd $TEMPDIR
# Then create the repos and branches on disk (if we need any new ones)
python /usr/local/bin/pkgdb_sync_git_branches.py
{% if env == 'staging' %}
# Leverage gitolite's Alias.pm feature to build backwards compat links
cat /etc/gitolite/RepoAliases.header > RepoAliases.pm
# Get all repos. Strip off 'rpms/'. Convert to perl mapping. Tack it on.
grep rpms/ /etc/gitolite/conf/gitolite.conf | \
sed 's/repo rpms\///g' | \
sed "s/.*/'&' => 'rpms\/&',/g" \
>> RepoAliases.pm
echo "};}1;" >> RepoAliases.pm
{% endif %}
# With that done, move the files into place and run compile
mv gitolite.conf /etc/gitolite/conf/
chown gen-acls:gen-acls -R /etc/gitolite/conf/
{% if env == 'staging' %}
mv RepoAliases.pm /etc/gitolite/RepoAliases.pm
chown gen-acls:gen-acls -R /etc/gitolite/RepoAliases.pm
{% endif %}
HOME=/srv/git /usr/bin/gitolite compile
{% if env != 'staging' %}

View file

@ -12,6 +12,14 @@
# "list of non-core programs shipped with gitolite" in the master index) or
# directly in the corresponding source file.
{% if env == 'staging' %}
# Hack!
# Pull in our repo aliases generated by genacls.sh
use lib ('/etc/gitolite/');
use RepoAliases qw( repo_aliases );
{% endif %}
%RC = (
# ------------------------------------------------------------------
@ -40,6 +48,10 @@
WRITERS => 1,
},
{% if env == 'staging' %}
REPO_ALIASES => repo_aliases(),
{% endif %}
# enable caching (currently only Redis). PLEASE RTFM BEFORE USING!!!
# CACHE => 'Redis',
@ -121,8 +133,10 @@
# no auto-create at all (don't forget to enable the 'create' command!)
'no-auto-create',
{% if env == 'staging' %}
# access a repo by another (possibly legacy) name
# 'Alias',
'Alias',
{% endif %}
# give some users direct shell access. See documentation in
# sts.html for details on the following two choices.