我有一台运行 Windows 2008R2 的 CruiseControl.Net 构建机器。源代码在 git 存储库中。CruiseControl 使用cygwin访问 git 存储库。除了标记外,一切都很好。我想标记每个成功的构建,所以这里是ccnet.config的一部分:
<sourcecontrol type="git">
<repository>git://xxx.xxx.xxx.xxx/Project</repository>
<executable>C:\cygwin\bin\git</executable>
<branch>projectName/branchToBuild</branch>
<workingDirectory>Sources</workingDirectory>
<autoGetSource>true</autoGetSource>
<tagOnSuccess>true</tagOnSuccess>
<tagCommitMessage>CCNet Build {0}</tagCommitMessage>
<tagNameFormat>project/builds/v{0}</tagNameFormat>
<committerName>CCNet</committerName>
</sourcecontrol>
但是构建失败并出现错误:
ThoughtWorks.CruiseControl.Core.CruiseControlException: Source control operation failed: error: unable to create temporary sha1 filename : No such file or directory
error: unable to write tag file
. Process command: C:\cygwin\bin\git tag -a -m "CCNet Build 6.2.18.0" project/builds/v6.2.18.0
at ThoughtWorks.CruiseControl.Core.Sourcecontrol.ProcessSourceControl.Execute(ProcessInfo processInfo)
at ThoughtWorks.CruiseControl.Core.Sourcecontrol.Git.GitCreateTag(String tagName, String tagMessage, IIntegrationResult result)
at ThoughtWorks.CruiseControl.Core.Sourcecontrol.Git.LabelSourceControl(IIntegrationResult result)
at ThoughtWorks.CruiseControl.Core.IntegrationRunner.Build(IIntegrationResult result)
at ThoughtWorks.CruiseControl.Core.IntegrationRunner.Integrate(IntegrationRequest request)
有什么问题?如果我从命令行执行相同的命令,一切正常。
谢谢!
通过将此添加到 msbuild 项目文件来解决:
<Exec Command='C:\cygwin\bin\git tag -a -m "CCNet Build" project/builds/v$(CCNetLabel)' ContinueOnError="true"/>
<Exec Command='C:\cygwin\bin\git push origin tag project/builds/v$(CCNetLabel)' ContinueOnError="true"/>