How to pass an environment variable to a build dependency from multiple builds?

I originally posted this at Stackoverflow and didn't get any response.  I'd like to see if I can resolve this issue.  Here's the original text from Stackoverflow:

I use N build configurations:

  • Build A
  • Build B
  • Build C
  • ...
  • Build N

All build configurations require the environment parameter "Param" in order to run. All build configurations have a snapshot dependency to "Build A". Any build configuration can use a different value for "Param".

How do I effectively get "Build A" the value for "Param" when it could be from any of N-1 configurations? Is there a way to find out what build initiated the build of "Build A"?

Since multiple configurations can cause "Build A" to be run, how do I get the "Param" value from the dependent build?


Comment actions Permalink

Hi Mike

There is no easy way to access these parameters. But if you describe your goals in more details, I could suggest alternate solutions.


Comment actions Permalink

Hi Michael,

We are using TeamCity to execute UI tests.  We have a series of build configurations that are set up to execute their own set of tests (for simplicity we'll call these the UI Tests).  We also have a set of tests that are used to determine if the environment is ready for testing (for simplicity, these are the Smoke Tests).  Each of the UI tests configurations have the Smoke Tests configuration as a Snapshot Dependency so that the Smoke Tests run prior to the UI test acting as a 'Preflight' or 'Gate' for the UI tests.  In addition, all of these configurations have an Environment Variable called "TestEnvironment" set to the environment in which the tests should be ran against.  So, for example the variable "Environment" is set to "TestEnv1".  This tells the tests which servers to target.  They are all set to the same value.

This works great for a single environment.  However, we have several different environments for different purposes.  There are times we wish to execute the tests in these different environments including having the Smoke Tests run prior to the UI tests.  It would be ideal to just run a custom build for the UI Tests we want to run, change the environment variable to the value we wish and wait for the results.  If use the custom build functionality, the UI tests will run in the configuration that is specified in the custom run but the Smoke Tests will run in the environment that they are set to in the configuration.

So, ultimately, we would like to be able to set an environment variable for a Snapshot Dependency configuration based on the configuration that has this dependency.  

Thans for the reply and sorry for the late response.


Please sign in to leave a comment.