SVN提交后和Jenkins遇到麻烦 [英] Trouble with SVN post-commit and Jenkins
问题描述
我正试图让CI与Jenkins一起发展.迄今为止,我们已经在环境中执行了两个计划的构建,但是我们的开发人员希望CI能够正常工作.我遵循了Jenkins Subversion插件Wiki页面中概述的说明:
I am trying to get CI going with Jenkins. To date, we have been performing two scheduled builds in our environment, but our dev staff wants to get CI working. I have followed the instruction outlined in the Jenkins Subversion Plugin wiki page:
https://wiki.jenkins-ci.org/display/JENKINS/Subversion +插件
这使我进入了一个可以在命令行执行的脚本,但是当我在Subversion中进行更改(使用TortoiseSVN客户端)时,提交似乎挂起,并且我看不到Jenkins得到通知.
This got me to a script that executes at the command line just fine, however when I commit a change in Subversion (using the TortoiseSVN client), the commit seems to hang and I don't see Jenkins getting notified.
这是我的剧本:
#!/bin/sh
REPOS="$1"
REV="$2"
UUID=`svnlook uuid $REPOS`
XSLT_FILE=/var/www/svn/codelog.xslt
RSS_FILE=/var/www/html/code_all.rss
MAX_RESULTS=40
/usr/bin/wget \
--auth-no-challenge \
--no-check-certificate \
--header "Content-Type:text/plain;charset=UTF-8" \
--post-data "`svnlook changed --revision $REV $REPOS`" \
--output-document "-" \
--timeout=2 \
https://192.168.100.16/subversion/${UUID}/notifyCommit?rev=$REV
svn log "file://$REPOS" --limit "$MAX_RESULTS" -v --xml | xsltproc "$XSLT_FILE" - > "$RSS_FILE"
脚本中已经包含RSS feed.那已经工作了一年多了.
The RSS feed was already in the script. That has been working for over a year.
在出现问题的情况下,我还更新了文件权限:
I have updated the file permissions as well, in case that was the problem:
[root@Subversion hooks]# ls post-commit -ao
-rwxrwxr-x 1 apache 530 Jul 17 06:27 post-commit
推荐答案
我从不喜欢SVN插件页面的编写方式.说起来很容易理解,您需要在SVN中设置一个Post Commit Hook才能使工作正常.你不要!
I have never liked how the SVN Plugin page is written. It is to easy to read it to say that you need to set up a Post Commit Hook in SVN to make things work. You Don't!
我们的詹金斯盒子上有大约10个版本.它们都链接到SVN信息库,并且都是由SVN信息库中的更改触发的.它们都不依赖于在SVN中使用Post Commit Hook.
We have about 10 builds on our Jenkins box. All of them are linked to SVN repositories, and all a triggered by changes in the SVN repository. None of them rely on having to use a Post Commit Hook in SVN.
为此,我们已将构建配置为按计划简单地轮询SCM". 提交"构建使用的时间表为"*/5 * * * *".这每5分钟轮询一次.我们的每日"构建使用的时间表为"1 1 * * *",这样,如果有任何更改,构建将在上午1:01开始.
To do this, we have configured the builds to simply "Poll SCM" on a schedule. The "commit" builds use a schedule of "*/5 * * * *". This polls every 5 minutes. Our "daily" builds use a schedule of "1 1 * * *" so that the builds would kick off at 1:01 AM if there are any changes.
这篇关于SVN提交后和Jenkins遇到麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!