Replace option in snapshot dependencies in TeamCity

I really can't understand the concept of snapshot dependencies in teamcity (7.1).

We have a build project that deploys the database according to the build parameter (database name and file), and I have a build project that creates and deploys our web application.

Now I would like to combine these two assemblies, but override the build parameter. I found a guide on how to access depency build options (% dep.btXX.yyy%), but I don’t want to access them, I want to override them!

How can i achieve this? I created a new assembly in which I run the assembly and deployment and then the assembly of the database, but it completely ignores my dependency settings, and also I can not change the assembly order.

Thanks for the help!

+6
source share
2 answers

Update: This answer only applies to TeamCity v8 or later.

I tried this myself, but unfortunately I suspect that this is not possible.

The Build Dependencies Setup documentation supports the following:

When assembly A depends on assembly B, you can transfer properties from assembly B to build A, that is, properties can only be transferred in the direction of building a chain flow, and not vice versa .

(usually reasonable) reason, I think it looks like the following:

  • A dependent assembly configuration may be dependent on more than one assembly configuration.

Think about this: if two parents want to pass their (different) parameters to a dependent assembly, what do they get for the “last successful build”? Theoretically, TeamCity can check whether the properties for the last build are necessary (rebuild otherwise). But even then, you get an ugly build history for assemblers for all different environments. This really does not fit the concept of assembly configurations.

The best way to reuse assembly configurations is to template them, and then create several projects that set properties at the project level so that they are available for all built-in assembly configurations.

Ultimately, a review may be the best advice if you really need to use two build configurations for your project. Best practice is to minimize the number of build configurations and build steps - if possible, add as much build logic to your own scripts.

0
source

According to the documentation, this is now possible in Teamcity 9:

Dependency Override Properties

Starting with TeamCity 9.0, it is possible to override dependency parameters by overriding them in the dependent assembly. For example, assembly configuration A depends on B and B depends on C; A has the ability to change parameters in any of its dependencies using the following format: reverse.dep ..

It is also possible to change the parameter in all dependencies at once: reverse.dep. *.

Dependent override properties can be specified in the parameter names of the dependent assembly A either in the dialog box of the custom assembly or through the configuration parameters of the assembly.

Clicking a new parameter in the assembly will replace the option “Do not start a new assembly if there is one” and may initiate a new assembly if the parameter is set to a value other than the default value.

+8
source

All Articles