branch as parameter

Completed

Situation: I have some version of project deployed on production. I would like to create similar environment like production. 

1) I get version from production

2) I switch to this version in my VCS system and deploy new environment.

How could I automate it in TC?

I have created to jobs:

getVersion - it gets production version and sets env.branchversion as parameter

deployTest - it has getVersion as dependency  and it contains following configuration parameter: teamcity.build.branch  with value  %dep.myProject_deployTest.env.branchversion%

 

And when I launch deployTest - branch remains to be default. Any chance to do it right?

 

 

 

0
3 comments

or maybe there is any chance to redefine global environment variable, which is defined in root project?

0

Hi! Unfortunately, you cannot change the build branch in the build runtime because the branch is defined when the build chain is getting resolved. However, you can still achieve what you want if you get the branch in your getVersion build, and trigger a build of deployTest via REST API in a build step of getVersion. See this documentation section for more details and let me know if you get stuck.

As a side note, if you need to give a deployTest's parameter the value of a parameter defined in getVersion, you need to use the dep.* parameter with the ID of getVersion build configuration, and not the deployTest configuration.

0

Hello! I have actually solved it using REST start of task and setting global project variable with version

0

Please sign in to leave a comment.