2
votes

Im trying to figure out how to chain multiple 'promotions' (by a user clicking) whilst ensuring that ever build in the chain is not queued. By current setup is as follows, NOTE as my application is a white label the configuration described below is repeated for every site.

  • Build & Test - Creates zipped artifact
  • Deploy to Testing - Has artifact and snapshot dependency
  • Deploy to Staging - Has artifact and snapshot dependency
  • Deploy to Production Has artifact dependency

When promoting to production i want to do this across all websites (without having to manually click promote on each build).

I am currently trying the following strategy, to set the 'deploy to production' build to have a Artifact dependency, without a snapshot dependency so it doesn't queue down the chain. I have set the artifact to depend on the 'Build & Test' configuration to gain access to the zipped project and i have set it to build with a specific build number referencing a parameter in the production build.

After doing some googleing i found out that i am able to get the stagings build number using the rest api as follows:

http://teamcity_url/httpAuth/app/rest/builds/buildType:build_configuration_id/resulting-properties/build.number

And this works great, however i don't understand how i can get this value into the parameter?

Also i dont know if my approach is correct? is there a better way?

1
There's a good answer to this question on the Jetbrains support site: teamcity-support.jetbrains.com/hc/en-us/community/posts/…Jorn

1 Answers

0
votes

Set up the artifact dependencies chronologically (Build -> Test -> Staging -> Production) and all your snapshot dependencies to Build & Test. Depending on exact needs you might have a snapshot dependency on both Build and the one your artifact dependency is on.

Also make sure you enable "Do not run new build if there is a suitable one. This should keep it from queuing down the chain without intention.

Using the build chain tab will be important because the main project page only shows the last build ran. So clicking run from there will que the chain because you are asking for a new build, even though to you it might feel like your asking for the next step to be ran. The build chain tab helps keep things clear.