Yan Sklyarenko
Yan Sklyarenko

Reputation: 32270

Is it possible to trigger a dependent build only in case the first in the chain is built from default branch?

Here is the scenario: I have a simple build chain of two configurations, the first builds the package, the other one deploys it and runs integration tests. Now the VCS root monitors master branch and pull requests (refs/pull/*/merge).

I would like it to work this way:

Is that possible to configure in TeamCity? Alternatively, is it possible through the REST API?

Upvotes: 2

Views: 878

Answers (1)

Nikita Skvortsov
Nikita Skvortsov

Reputation: 4923

I assume, the deploy configuration has snapshot dependency on build configuration.

TeamCity VCS trigger can have branch filter, that limits triggering to some logical branch name.

  • To have logical names like pull/*, change the branch spec in vcs root to

    refs/(pull/*)/merge

  • Add vcs trigger in "Build" configuration, with Branch Filter set to:

    +:pull/*

  • Add vcs trigger in "Deploy" configuration, with Branch Filter set to:

    +:<default>

This should trigger Build on pull requests and Build + Deploy on commits to default (master) branch.

Upvotes: 4

Related Questions