Search code examples
kotlinteamcitypipeline

Passing/Initializing Parameter from Last Build in TeamCity Build Chain


I just started with the TeamCity CI server. I have 2 builds

  • API-Tests
  • UI-Tests

Both these builds run in parallel whereas both the builds will have a dropdown config parameter with choices(Regression, Sanity)

I have a build name Release with a similar dropdown config parameter with choices(Regression, Sanity) and this build depends on both API-Tests and UI-Tests. The build Release will have to trigger manually by choosing the dropdown parameter(Regression, Sanity).

I want to pass the option chosen in the Release build to both API-Tests and UI-Tests builds. I can't use %dep.*%, since Release build depends on API-Tests and UI-Tests builds.

I have attached the build chain for reference. Please guide me to fix the requirement or suggest at least a workaround.

Sample Build Chain


Solution

  • It seems like you're looking for the reverse.dep.* pattern, which is best described in the official documentation.

    Quoting the docs:

    It is possible to redefine build parameters in the snapshot-dependency builds when the current build starts. For example, build configuration A depends on B and B depends on C; on triggering, A can change any parameter used in B or C.

    It looks like this is your case:

    To change a parameter in all dependencies at once, use a wildcard: reverse.dep.*.<property_name>

    Anyway, I would encourage you to read the whole article to get thorough understanding of the subject and choose the most suitable option.