在TeamCity构建步骤中使用git命令 [英] Using git commands in a TeamCity Build Step
问题描述
我的一个TeamCity v7.0构建项目依赖于在当前开发分支和主分支之间使用差异来确定需要运行的东西。我写了一个小脚本,使用类似于:
git diff origin / master..origin / QA --name-只--diff-filter = AM | DoSomethingWithThoseFiles
不幸的是,构建日志表明 git diff
不工作。当我进入这个项目的buildAgent / work目录时,我发现没有 .git
文件夹,所以它无法执行所需的git操作。
我已将 teamcity.git.use.local.mirrors = true
放入 buildAgent.properties
文件,如 TW-15873 中所述,但这似乎无助于任何方式。
有什么我可以做的,让我的构建步骤脚本中的两个分支之间更改的文件列表?
尝试将VCS签出模式更改为始终在代理上签出文件,如这里。这应该使build脚本可以访问.git文件夹。
One of my TeamCity v7.0 build projects relies on using a diff between the current development branch and the master branch to determine what needs to be run. I've written a small script that uses something like:
git diff origin/master..origin/QA --name-only --diff-filter=AM | DoSomethingWithThoseFiles
Unfortunately, the build log indicates that git diff
is not working. When I go into the buildAgent/work directory for this project, I see that there is no .git
folder, so it cannot perform the git operations required.
I've put teamcity.git.use.local.mirrors=true
in the buildAgent.properties
file as mentioned at TW-15873, but that does not seem to help in any way.
Is there anything I can do to get the list of files changed between two branches in a script for my build step?
Try changing the VCS checkout mode to "Always checkout files on agent" as documented here. That should give the build script access to the .git folder.
这篇关于在TeamCity构建步骤中使用git命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!