Passing library version to another build

Answered

I am pretty new to TC and so this might be trivial, however I was unable to find the answer as of now.

I have two builds, first of which is a library, that on each build as the very first step updates its own version number (in the POM file). Next one is a demo application using this library. I'd like—upon library successful build—to start the demo app build, pass the new version number to it and use it in some files in the demo app. The library build success cannot of course be dependent on the demo app build success.

I believe I can do the first step with the Finish Build Trigger on the library build and the last I suppose can be done with File Content Replacer, however I cannot find out how to pass the library new version number from the trigger to the second build. Is there a way to do so?

Regards, Marcel

1 comment
Comment actions Permalink

Hello Marcel,

I see a couple of options to solve the problem, both approaches utilize Dependencies:

  • Use Artifact Dependencies: this way you can transfer the pom.xml with the updated version number to the demo app build configuration and use it there.
  • Use dependency parameters to pass the build number. We have an article that describes how to share the build number between dependent builds. This is a simple case, but you can use it as well if you update the system.build.number parameter to store the version number. You can also use your own custom parameter to store the version number, and update it with the help of service messages at the end of the library build configuration.

Regarding Finish Build Trigger: it's fine to use it, but if you are going to create a build chain out of two build configurations, I would recommend having a VCS Trigger at the end of the build chain (provided that both the library and the demo app build configurations use the same VCS Roots). This way, whenever there is an update in your sources, the entire build chain will be triggered. TeamCity will try to trigger a demo app build if there's a suitable library build, otherwise, it will first trigger a library build. The advantage is that there will be no unnecessary builds, and the entire build chain will be always build on the same sources.

I hope this information helps. Let me know if you have any other questions.

0

Please sign in to leave a comment.