1
votes

The title might be a little vague, but what I'm trying to do is build a SOA application in TeamCity.

Basically I have a Project called Continuous Build. In that project are 6 build configurations, one for each service. Then, I have another Project called "Alpha", and a third project called "Beta".

Now I know that I can used Chained builds to share the build number, but what I can't do with that approach is increament that build number across "Continuous", "Alpha", and "Beta", while maintaining a unified number across each build configuration.

Here's hopefully an example to explain what I'm trying to do.

- Continuous Build (project)
    - SVC 1 (build number 1.2.34)
    - SVC 2 (build number 1.2.34)
    - SVC 3 (build number 1.2.34)
    - SVC 4 (build number 1.2.34)
    - SVC 5 (build number 1.2.34)
    - SVC 6 (build number 1.2.34)
 - Alpha Build (project)
    - SVC 1 (build number 1.2.30)
    - SVC 2 (build number 1.2.30)
    - SVC 3 (build number 1.2.30)
    - SVC 4 (build number 1.2.30)
    - SVC 5 (build number 1.2.30)
    - SVC 6 (build number 1.2.30)
- Beta Build (project)
    - SVC 1 (build number 1.1.0)
    - SVC 2 (build number 1.1.0)
    - SVC 3 (build number 1.1.0)
    - SVC 4 (build number 1.1.0)
    - SVC 5 (build number 1.1.0)
    - SVC 6 (build number 1.1.0)

Whereby the next build coming will increment to 1.2.35 regardless of which project picks up the next build.

I'm currently using AutoIncrementer, but then I end up with the following (which is not ideal)

- Continuous Build (project)
    - SVC 1 (build number 1.2.34)
    - SVC 2 (build number 1.2.35)
    - SVC 3 (build number 1.2.36)
    - SVC 4 (build number 1.2.37)
    - SVC 5 (build number 1.2.38)
    - SVC 6 (build number 1.2.39)

Is there any kind of work around available to achieve what I'm looking for?

Here's an example of my current config.

enter image description here

1

1 Answers

1
votes

Here's what I would try:

  1. Create another separate build configuration that just supplies the build number you want all the others to use.
  2. Make that build number config a snapshot dependency of all your other configurations.
  3. In general settings of each build configuration, set the build number to the value coming from your build number configuration. If it was named BuildNumberGenerator, then you'd use %dep.BuildNumberGenerator.system.build.number% in the Build number format: field.

Edit: Just saw your statement in the question that you know how to do chained builds to share the build number. Steps 2 and 3 above are exactly that.

Also, I don't see a reason for the AutoIncrementer plugin with this technique.

I don't know about it incrementing multiple times. Would need to try it out and see what happens. You could use a Finish Build Trigger to kick off all the other builds instead of having them be dependencies. So, you'd start the build root (which could be used as build number generator) and the Finish Build Triggers would start all the other builds that have root as a snapshot dependency.