Passing variables between build configurations in different projects

Hi,

We have multiple infrastructure libraries written in Java and dependency resolution tool is Gradle. The builds of these libraries depend on each other 

Example

Infrastructure Lib A in Git

Infrastructure Lib B in Git

Infrastructure Lib B depends on A so any time a new version of A is done B needs to be rebuilt.

We have builds for two projects in teams city for each library with build definitions.

I would like to trigger build of library B after build of library A is completed, pass in version of library A in the build definition of library B. Update library B's gradle files and build.

Any guidance on how to achieve that will be appreciated.

I think I can add a trigger on library B's build when A's build complete but don't know how to pass version between build definitions of 2 different projects and update gradle files.

Thanks,

Zeeshan

0
1 comment

Hi Zeeshan,

It seems like it's pretty easy:
Setting up a snapshot dependency from B to A, and making sure the trigger is on B will automatically trigger both B and A, and B will wait until A is completed to run. No need for special triggers on that regard.

Passing something depends on what that something is. You can pass any files as "artifact dependencies", so you could even add complex structures in those files and then parse them on the new build. If you just want to pass values, you can use parameters from the dependencies.

Some pointers in our documentation:
-Snapshot dependencies: https://confluence.jetbrains.com/display/TCD18/Snapshot+Dependencies
-Artifact dependencies: https://confluence.jetbrains.com/display/TCD18/Artifact+Dependencies
-Parameters: https://confluence.jetbrains.com/display/TCD18/Predefined+Build+Parameters#PredefinedBuildParameters-DependenciesProperties

0

Please sign in to leave a comment.