如何构建一个git轮询构建bot? [英] How to build a git polling build bot?
本文介绍了如何构建一个git轮询构建bot?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何一个小cron,bash + make基于脚本(例如,比例如更小,不如哈得逊鲁棒)build-bot轮询一个Git仓库,并检测它是否应该构建现在。如果在定期从远程git repo中拉出,它已经检索到新的代码?
How can a little cron, bash + make based script (e.g. much smaller and less robust than, for example, Hudson) build-bot poll a git repo and detect if it should build now - e.g. if in its periodic pull from the remote git repo, it has retrieved new code?
目前,它看起来像这样:
Currently, it looks like this:
git fetch > build_log.txt 2>&1
if [ $? -eq 0 ]
then
echo "Fetch from git done";
git merge FETCH_HEAD >> build_log.txt 2>&1 ;
if [ $? -eq 0 ]
then
echo "Merge via git done"; ...
# builds unconditionally at the moment
fi
fi
推荐答案
如果没有提取任何内容,则get fetch将不会输出行,因此只需在build_log.txt中检查零文件大小:
If nothing was fetched, then "get fetch" will output no lines, so just check for zero filesize on build_log.txt:
git fetch > build_log.txt 2>&1
if [ -s build_log.txt ]
then
# build
fi
这篇关于如何构建一个git轮询构建bot?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文