从Subversion存储库实现强大的自动化。
svnpublish的Python项目详细描述
欢迎使用svnpublish,这是一个启用自动发布(和 任何其他要执行的任意命令)。 Subversion版本控制存储库。
发布配置绑定到整个存储库或 仅限于子目录,在中称为publishing point 发表演说。
tl;dr
安装:
$ pip install svnpublish
$ mkdir -p /etc/svnpublish
$ svnpublish --init-options > /etc/svnpublish/myrepos.yaml
# edit the self-documenting configuration file:
$ vi /etc/svnpublish/myrepos.yaml
放入REPOSITORY/hooks/post-commit:
#!/bin/sh svnpublish --options /etc/svnpublish/myrepos.yaml "$@"
如果以异步模式运行(推荐):
$ apt-get install daemontools-run # create the service directory with the user:group that runs svnpublish $ svnpublishd --init-service --service-dir /etc/service/svnpublishd --user www-data:www-data # review the output and adjust the service configuration: $ vi /etc/service/svnpublishd/run /etc/service/svnpublishd/log/run # grant the user running svnpublish access to HUP the service # (this assumes that "#includedir /etc/sudoers.d" is in "/etc/sudoers.d", # that the user is www-data, and that svc is located in /usr/bin) $ echo"www-data ALL = NOPASSWD: /usr/bin/svc -h /etc/service/svnpublishd" > /etc/sudoers.d/svnpublishd $ chmod 440 /etc/sudoers.d/svnpublishd # start the service $ rm -f /etc/service/svnpublishd/down $ svc -u /etc/service/svnpublishd
然后将“–async”选项添加到svnpublish(确保 servicedir选项在svnpublish“options.yaml”中设置正确 文件)。扩展上面的例子,新的post commit钩子应该 看起来像:
#!/bin/sh svnpublish --options /etc/svnpublish/myrepos.yaml --async "$@"
注意:建议将日志目录移动到 系统适当的位置-请参阅 /etc/service/svnpublishd/log/run。
概述
TOdo:添加文档
全局配置
设置初始svnpublish选项的最佳方法是使用 --init-options标志,它输出所有可用选项的列表 随附文件。建议的方法是 /etc/svnpublish/中的每个存储库配置可以是 操作如下:
$ sudo mkdir -p /etc/svnpublish
$ svnpublish --init-options | sudo tee /etc/svnpublish/REPOSITORY.yaml > /dev/null
$ sudo vi /etc/svnpublish/REPOSITORY.yaml
然后根据需要修改所有选项。至少, 应设置以下选项:
- 管理员
- 标签
- 姓名
- 回复
- genemail.default.headers.from
发布点配置
TOdo:添加文档
publish:ENGINE:ATTRIBUTE:VALUE
示例:
publish:# send an email notification-engine:emailmailfrom:noreply@example.comrecipients:-user1@example.com-user2@example.com# update an RSS (atom) feed-engine:rsswindow:50label:Repository Feedoutput:/var/www/rss/output.xmlfeedUrl:https://svn.example.com/rss/output.xml# export the repository to the file system-engine:exportpath:/var/www/example.comfixate:-{ engine:fingerprint}-{ engine:fingerprint, path:htdocs/fingerprint}# export the repository to a remote host-engine:exportremote:svnpublish@example.comkeychain:/home/svnpublish/.keychainpath:/var/www/example.comfixate:-{ engine:fingerprint}-{ engine:fingerprint, path:htdocs/fingerprint}
加密电子邮件
svnpublish可以配置为发送pgp加密的电子邮件,其中 保护电子邮件内容不被意外读取 收件人。按照中的说明操作 https://pypi.python.org/pypi/genemail要设置gpg主目录, 然后调整svnpublish“options.yaml”文件以包含 PGP修改器。例如:
# ... other configurations ...genemail:modifier:class:'genemail.PgpModifier'sign:'noreply@example.com'gpg_options:gnupghome:'/path/to/gpghome'
异步操作
svnpublish可以在异步模式下运行(推荐的方法)。 这意味着提交发生得很快,并且是一个异步进程 然后负责执行发布。这个异步的 进程svnpublishd已调整为由DJB运行 daemontools。基于debian的 系统、Daemontools可以轻松安装:
$ apt-get install daemontools-run
svnpublishd服务目录可以由 调用svnpublishd --init-service OPTIONS,这将创建 目录、“运行”脚本和所需的默认日志记录选项 要运行svnpublishd,请为指定用户定制:组 svnpublish运行方式。确保此用户:组设置很重要 是正确的,否则svnpublish和svnpublishd不能 沟通。svnpublish通常运行的user:group Subversion存储库的所有者。例如,如果您的svnpublish 作为www data:www data运行,则类似这样的操作应该可以:
$ svnpublishd --init-service --service-dir /etc/service/svnpublishd --user www-data:www-data
版权声明
此软件是免费软件:您可以重新分发它和/或 根据GNU通用公共许可条款修改为 由自由软件基金会出版,或者 许可证,或(由您选择)任何更高版本。
这个软件的发布是希望它会有用,但是 没有任何保证;甚至没有 适销性或适合某一特定目的的适销性。看GNU 一般公共许可证了解更多详细信息。
你应该收到GNU通用公共许可证的副本 还有这个节目。如果没有,请参阅http://www.gnu.org/licenses/。
(c)版权所有2013-EOT Metagriffin–见license.txt