git - 如何为 TeamCIty 中的未决更改编写 git 日志

标签 git github teamcity commit

我配置了一个 TeamCity 代理来构建我的 XCode 项目,并且我使用 github。我想在我的发行说明中自动包含 TeamCity 中所有待定提交的描述。

如何从 github 获取它们并将它们存储在 teamcity 中?一旦我将它们放入 teamcity 变量中,我就可以轻松地将它们添加到我的构建脚本中。

最佳答案

这就是我最终使用 bash 脚本执行此操作的方式:

#!/bin/bash 

curl -o lastBuild.tmp "http://localhost:8111/app/rest/buildTypes/id:bt2/builds/status:SUCCESS" --user rest:rest
last_commit=`xpath lastBuild.tmp  '/build/revisions/revision/@version'| awk -F"\"" '{print $2}'`

echo "##Last commit = $last_commit"
# prepare build notes
NOTES=`git log --pretty=format:"- %s" $last_commit..origin/master`

echo "this is it:$NOTES"

一些解释:

  1. 使用curl 从您的构建配置中获取最后一次成功的构建。在我的示例中,这是 bt2,请确保将其替换为您的
  2. 使用 XPath/AWK 解析 XML 响应并获取最新的 git 版本
  3. 使用 git log 从上次构建中获取所有更改,并根据需要格式化它们。我只想获取提交说明。

关于git - 如何为 TeamCIty 中的未决更改编写 git 日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10794300/

相关文章:

linux - 将 Github repo 推送到其他现有帐户(而不是默认帐户)?

git - 如何git rm一个名称以 ':'开头的文件

git - 将外部更改 merge 到我的 Git 存储库的最佳方式是什么?

github - zsh : permission denied:/Users/ryanshumway/. ssh

javascript - git apply --recount 对我不起作用

git - 在 linux 上将 bazaar repo 转换为 git

git - 为什么 git ://works but git@ does not

.net - TeamCity 中代码覆盖率的属性过滤器语法

command-line - Team City Command Line Build Runner

build - teamcity 以特定用户身份运行构建