TeamCity将参数从服务器传递给构建代理程序

Lev*_*Lev 6 git teamcity continuous-integration

我想在构建代理上进行手动版本控制的提交,

version = git rev-list --count "branchname"
Run Code Online (Sandbox Code Playgroud)

git 在构建代理上不可用,因为我已签出"在服务器上自动".

有没有办法version从结账服务器传递到构建代理?(无需更改VCS checkout mode构建代理)?

我正在运行最新的9.1.6版TC.

Cod*_*ard 2

有没有办法将版本从结帐服务器传递到构建代理?(无需更改 VCS 结帐模式来构建代理)?

简短的回答是你做不到

您可以尝试做的是:

- Add a version file to your repository,   
- **before** commiting use a git hook to update this file with the desired number
- Read the content of the file on your build server and you have it.

- Use a git hook to call a job on your build server which gets the 
  branch name and the number of commits and store it for later use somewhere
Run Code Online (Sandbox Code Playgroud)

要点是,既然你做不到,你就需要一点创意


示例钩子可以是:

pre-receive hook

- Add a version file to your repository,   
- **before** commiting use a git hook to update this file with the desired number
- Read the content of the file on your build server and you have it.

- Use a git hook to call a job on your build server which gets the 
  branch name and the number of commits and store it for later use somewhere
Run Code Online (Sandbox Code Playgroud)