Teamcity, set configuration parameter for next build

半世苍凉 提交于 2019-12-05 17:20:23

You can publish an artifact with the value you want in build 1, introduce an artifact dependency from build 2 to build 1, and in the first step of build 2 transform that artifact into a configuration value again for the other steps in build 2 by using the echo (or better Write-Host) statement you mentioned.

psych

You can solve this in the same way I did for: Is it possible to permanently update the value of a TeamCity build parameter as a result of a custom run?

Build 1 can update a variable which is being used in build 2 rather than build 2 trying to read a parameter in build 1.

Download and install CURL on build agent:

Add a command line step to build 1:

curl -v --request PUT -d "%Target environment%" --Header "Content-Type: text/plain" http://username:password@servername:8080/httpAuth/app/rest/projects/Build2Project/parameters/ENVIRONMENT

This updates the value of a parameter on a project, but you can use the REST API to update it on a particular build configuration if you prefer.

All REST.API documentation for TeamCity v8 can be found on their website

You can reference MyVariable variable which you set in Build configuration 1 in a script in Build configuration X such way: %dep.BuildConfiguration1Id.MyVariable%

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!