- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想知道是否有一种简单的方法可以使用 gitolite_admin 为某些存储库安装 Hook 。
假设我想使用gitolite_admin<为仓库更新后 Hook 很棒/strong> 存储库克隆到我的工作站...
#conf/gitolite_conf
repo awesome
RW+ = deployer
更新后的内容:
#!/bin/sh
echo "Post receive-hook => updating Redmine repository"
sudo -u deployer perl -we '`cd /home/deployer/repo/awesome.git && git fetch -q --all`'
最佳答案
您还可以查看“repo-specific environment variables”
A special form of the option syntax can be used to set repo-specific environment variables that are visible to gitolite triggers and any git hooks you may install.
For example, let's say you installed a post-update hook that initiates a CI job. By default, of course, this hook will be active for all gitolite-managed repos. However, you only want it to run for some specific repos, say r1, r2, and r4.
To do that, first add this to the
gitolite.conf
:
repo r1 r2 r4
option ENV.CI = 1
This creates an environment variable called GL_OPTION_CI with the value 1, before any trigger or hook is invoked.
Note: option names must start with
ENV.
, followed by a sequence of characters composed of alphas, numbers, and the underscore character.Now the hook running the CI job can easily decide what to do:
# exit if $GL_OPTION_CI is not set
[ -z $GL_OPTION_CI ] && exit
... rest of CI job code as before ...
Of course you can also do the opposite; i.e. decide that the listed repos should not run the CI job but all other repos should:
repo @all
option ENV.CI = 1
repo r1 r2 r4
option ENV.CI = ""
<小时/>
该功能是最近才出现的(开始于 commit 999f9cd39 ,但在本例中,完成于 commit 63865a16 2013 年 6 月的 3.5.2)。
但即使您没有该版本,也有其他方法可以使用选项变量来执行此操作,如该部分的最后部分所述。
Before this feature was added, you could still do this, by using the
gitolite git-config
command inside the hook code to test for options and configs set for the repo, like:
if gitolite git-config -q reponame gitolite-options.option-name
then
...
并且您可以以相同的方式使用 git 配置变量。
或者您可以使用组成员资格 - 请参阅针对 function "in_group
" 的评论详情见“Easy.pm
”。
# in_group()
# return true if $ENV{GL_USER} is set and is in the given group
# shell equivalent
# if gitolite list-memberships $GL_USER | grep -x $GROUPNAME >/dev/null; then ...
关于gitolite_admin Hook 和镜像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18430522/
我想知道是否有一种简单的方法可以使用 gitolite_admin 为某些存储库安装 Hook 。 假设我想使用gitolite_admin 存储库克隆到我的工作站... #conf/gitolite
我是一名优秀的程序员,十分优秀!