Build chain with DSL: follow up builds not triggered

Completed

We try to use the new Build Chain DSL Extension as described here: https://www.jetbrains.com/help/teamcity/kotlin-dsl.html#KotlinDSL-BuildChainDSLExtension

The build chain gets created and will be shown in the UI bit if the first build gets triggered (manually or VCS trigger), the follow up builds not.

It works if we add  a finishBuildTrigger to every follow up build type but our impression was that dependsOn should do the job.

 

0
4 comments

Hi Lars,

 

this is a common misunderstanding on how triggering works for build chains. Finish build triggers are not needed. If you follow the links in the documentation, to build chains and then snapshot dependencies, which is the basic building block upon which build chains are constructed, you will find this information:

https://www.jetbrains.com/help/teamcity/build-dependencies-setup.html#BuildDependenciesSetup-HowSnapshotDependenciesWork

 

In particular, triggering should not happen on the first build of the chain, it should be on the last. This will automatically trigger all of its dependencies and make sure a suitable one is available once the build is ran. This is the case for all kinds of triggers, manual and automatic.

 

While this can be a bit counterintuitive when considering a build chain as a whole, build configurations are reusable and can be a part of multiple chains, and sometimes you can be interested in triggering some of them independently. Because of this, dependencies work from end to start rather than the opposite. Put it in another way, if A depends on B, that generates a chain B - A, that tells TeamCity that A requires an instance of B to work, but does not mean that B requires an instance of A to be run afterwards.

 

I hope this clarifies it for you. I'm going to try and get this information added into the build chains page directly so that it's not required to have to go through so many jumps to get to it, unfortunately snapshot dependencies came in first, build chains afterwards, and the dsl was built on top of those so it was created with the understanding of everything else already in place.

0

As a quick follow up, I've created this issue in the tracker to discuss and improve our documentation on it: https://youtrack.jetbrains.com/issue/TW-65275. Feel free to watch and vote for it.

0
Avatar
Permanently deleted user

Thanks for your description.


Ok I understand that snapshot dependencies are the key for linking build blocks but could you point out how the correct syntax for a build chain with DSL (Kotlin) have to look like? 

A small example would be super cool.


0

Hi Lars,

 

The syntax on our examples is fine. The examples we have do not include any trigger because those are defined at the build level rather than at the chain level, while we only reference the builds. We want to be careful, as users who try that approach but have preexisting triggers set at the build config level might think they are independent entities while they are actually being joined and might override each other.

 

In the meantime, something like this should work:

 

project {
buildType(First)
buildType(Second)

sequential {
buildType(First)
buildType(Second).triggers {
vcs {
watchChangesInDependencies = true
}
}
}
}
0

Please sign in to leave a comment.