PhpUnderControl 持续集成设置中的 Git 日志错误
因此,我为我的 PHP 项目设置了以下内容:
- 包含所有代码的 Git 存储库。
- Cruisecontrol 的实例,其上运行有 PhpUnderControl。
我在 Cruisecontrol 项目目录中创建了一个新项目,并设置了一个轮询器每 2 分钟检查 git 存储库上的更改。我在这个 Cruisecontrol 实例中运行了 2 个项目,我设置的第一个项目工作得很好。
我在平台项目中遇到的问题在错误日志中看起来像这样:
2010-02-04 06:07:27,076 [Thread-14061] INFO Project - Project platform: bootstrapping 2010-02-04 06:07:27,077 [Thread-14061] INFO ProjectController - platform Controller: build progress event: bootstrapping 2010-02-04 06:07:27,496 [Thread-14061] INFO GitBootstrapper - Already up-to-date. 2010-02-04 06:07:27,500 [Thread-14061] INFO Project - Project platform: checking for modifications 2010-02-04 06:07:27,500 [Thread-14061] INFO ProjectController - platform Controller: build progress event: checking for modifications 2010-02-04 06:07:27,583 [Thread-14063] WARN Git - warning: Log for '' only goes back to Tue, 26 Jan 2010 13:43:11 -0500. 2010-02-04 06:07:27,584 [Thread-14063] WARN Git - fatal: Invalid revision range @{ 1264038932}..@{ 1265281647} 2010-02-04 06:07:27,584 [Thread-14061] INFO Project - Project platform: No modifications found, build not necessary. 2010-02-04 06:07:27,584 [Thread-14061] INFO Project - Project platform: idle 2010-02-04 06:07:27,584 [Thread-14061] INFO ProjectController - platform Controller: build progress event: idle
这里奇怪的是,当我检查项目目录时,代码库会更新。 (我在工作目录中进行了一些小的提交测试。)问题是,自从 Git 出错以来,它永远不会运行任何其他构建过程。
如果我直接进入 projects/platform
目录并执行 git pull,它就可以正常工作。从项目目录进行 ant 构建也可以正常工作。
以下是相关的配置文件:
<project name="platform" buildafterfailed="false">
<plugin name="git" classname="net.sourceforge.cruisecontrol.sourcecontrols.Git" />
<modificationset quietperiod="60">
<git localWorkingCopy="projects/${project.name}/" />
</modificationset>
<bootstrappers>
<gitbootstrapper localWorkingCopy="projects/${project.name}/" />
</bootstrappers>
<schedule interval="120">
<ant antscript="/usr/bin/ant" buildfile="projects/${project.name}/build.xml" />
</schedule>
<listeners>
<currentbuildstatuslistener file="logs/${project.name}/status.txt"/>
</listeners>
<log dir="logs/${project.name}">
<merge dir="projects/${project.name}/build/logs/" />
</log>
<publishers>
<artifactspublisher dir="projects/${project.name}/build/api"
dest="artifacts/${project.name}"
subdirectory="api"/>
<artifactspublisher dir="projects/${project.name}/build/coverage"
dest="artifacts/${project.name}"
subdirectory="coverage"/>
<execute command="phpuc graph logs/${project.name} artifacts/${project.name}"/>
<execute command="phpcb
--log projects/${project.name}/build/logs
--source projects/${project.name}/lib/model
--ouput projects/${project.name}/build/php-code-browser" />
<artifactspublisher dir="projects/${project.name}/build/php-code-browser"
dest="artifacts/${project.name}"
subdirectory="php-code-browser" />
</publishers>
</project>
我对 git 错误的搜索没有给我任何好的见解,所以希望这里有人知道!
So I have set up the following for my PHP project:
- A Git repository with all the code.
- An instance of Cruisecontrol with PhpUnderControl running on top of it.
I created a new project in the cruisecontrol project directory and set up a poller to check changes on the git repo every 2 minutes. I have 2 projects running in this Cruisecontrol instance, and the first one I set up works just fine.
The issue I am having with the Platform project looks like this in the error logs:
2010-02-04 06:07:27,076 [Thread-14061] INFO Project - Project platform: bootstrapping 2010-02-04 06:07:27,077 [Thread-14061] INFO ProjectController - platform Controller: build progress event: bootstrapping 2010-02-04 06:07:27,496 [Thread-14061] INFO GitBootstrapper - Already up-to-date. 2010-02-04 06:07:27,500 [Thread-14061] INFO Project - Project platform: checking for modifications 2010-02-04 06:07:27,500 [Thread-14061] INFO ProjectController - platform Controller: build progress event: checking for modifications 2010-02-04 06:07:27,583 [Thread-14063] WARN Git - warning: Log for '' only goes back to Tue, 26 Jan 2010 13:43:11 -0500. 2010-02-04 06:07:27,584 [Thread-14063] WARN Git - fatal: Invalid revision range @{ 1264038932}..@{ 1265281647} 2010-02-04 06:07:27,584 [Thread-14061] INFO Project - Project platform: No modifications found, build not necessary. 2010-02-04 06:07:27,584 [Thread-14061] INFO Project - Project platform: idle 2010-02-04 06:07:27,584 [Thread-14061] INFO ProjectController - platform Controller: build progress event: idle
The strange thing here is that when I check the project directory, the code base gets updated. (I tested with a few small commits in my working directory.) The problem is that this never runs any of the other build processes since Git errors out.
If I go to the projects/platform
directory directly and do a git pull, it works fine. Doing an ant build from the project directory also works just fine.
Here are the relevant config files:
<project name="platform" buildafterfailed="false">
<plugin name="git" classname="net.sourceforge.cruisecontrol.sourcecontrols.Git" />
<modificationset quietperiod="60">
<git localWorkingCopy="projects/${project.name}/" />
</modificationset>
<bootstrappers>
<gitbootstrapper localWorkingCopy="projects/${project.name}/" />
</bootstrappers>
<schedule interval="120">
<ant antscript="/usr/bin/ant" buildfile="projects/${project.name}/build.xml" />
</schedule>
<listeners>
<currentbuildstatuslistener file="logs/${project.name}/status.txt"/>
</listeners>
<log dir="logs/${project.name}">
<merge dir="projects/${project.name}/build/logs/" />
</log>
<publishers>
<artifactspublisher dir="projects/${project.name}/build/api"
dest="artifacts/${project.name}"
subdirectory="api"/>
<artifactspublisher dir="projects/${project.name}/build/coverage"
dest="artifacts/${project.name}"
subdirectory="coverage"/>
<execute command="phpuc graph logs/${project.name} artifacts/${project.name}"/>
<execute command="phpcb
--log projects/${project.name}/build/logs
--source projects/${project.name}/lib/model
--ouput projects/${project.name}/build/php-code-browser" />
<artifactspublisher dir="projects/${project.name}/build/php-code-browser"
dest="artifacts/${project.name}"
subdirectory="php-code-browser" />
</publishers>
</project>
My searches on the git error haven't given me any good insight, so hopefully someone here knows!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来没有设置可供 git 签出的分支。我不知道如何立即解决这个问题,但这可能是前进的方向。
It looks like there is no branch set for git to checkout. I don't know how to fix that right away, but that might be the direction to go.
快速修复:
解决此问题最干净、最快的方法是在项目标签上设置 requireModification="false"。等待构建启动,然后再次设置 requireModification="true"。这将产生创建新的先前构建日期的效果,该日期在可用的 git 日志更改范围内。
详细信息:
当我在巡航控制环境中重新克隆我的存储库时,就发生了这种情况。这会产生一个问题,即存储库日志的本地工作副本不会返回到 Cruisecontrol 执行的最后一次构建。
发生的情况是您的最后构建日期早于本地工作存储库中最旧的更改记录:(哎呀。
这在 gitbootstrapper 中没有发生。您的引导程序执行得很好。
请参阅:2010-02-04 06:07: 27,496 [Thread-14061] INFO GitBootstrapper - 已经是最新的,
我们很好。
该问题由 ProjectController 在调用“getModifications”时报告。
参见:
2010-02-04 06 :07:27,500 [Thread-14061] INFO ProjectController - 平台控制器:构建进度事件:检查修改
2010-02-04 06:07:27,583 [Thread-14063] WARN Git - 警告:“”的日志仅返回到 2010 年 1 月 26 日星期二 13:43:11 -0500。
Git 类中执行的代码在 net.sourceforge.cruisecontrol.Git.getModifications 中
执行的命令为:
git log -p --pretty=raw @{timestamp}..@{timestamp}
例如: git log -p - -pretty=raw @{1292455850}..@{1299108639}
基本问题是参数被传递到第一个时间戳中,cruisecontrol 正在按照编程的方式执行操作,但我们要求它检查日期之间的更改我们的存储库没有记录,如果 requireModification="true",那么它将因发现没有修改而关闭!
Quick fix:
The cleanest and quickest way to fix this is to set requireModification="false" on the project tag. Wait for a build to fire, then set requireModification="true" again. This will have the effect of creating a new previous build date that is within the range of your available git log changes.
Details:
This happened to me when I re-cloned my repositories within my cruisecontrol environment. This creates an issue where the local working copy of the repository's logs don't go back as far as the last build that cruisecontrol performed.
What happens is that your last build date is older than the oldest change record in your local working repository :( ouch.
This is not happening in the gitbootstrapper. Your bootstrapper is executing just fine.
See: 2010-02-04 06:07:27,496 [Thread-14061] INFO GitBootstrapper - Already up-to-date.
No errors. We're good.
The problem is being reported by Git, as executed by ProjectController when it calls "getModifications"
See:
2010-02-04 06:07:27,500 [Thread-14061] INFO ProjectController - platform Controller: build progress event: checking for modifications
2010-02-04 06:07:27,583 [Thread-14063] WARN Git - warning: Log for '' only goes back to Tue, 26 Jan 2010 13:43:11 -0500.
The code executed in the Git class is in net.sourceforge.cruisecontrol.Git.getModifications
The command executed is:
git log -p --pretty=raw @{timestamp}..@{timestamp}
for example: git log -p --pretty=raw @{1292455850}..@{1299108639}
The basic problem is the parameter being passed into the first timestamp, cruisecontrol is doing exactly what it is programmed to do, but we are asking it to check for changes between dates that our repository has no record of, if requireModification="true", then it will shut down having found no modification!