2

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:

  • if there's a pull request, only the first configuration is triggered (but not the dependent one)
  • if there's a push to master, the whole chain runs

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

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139

1 Answers1

4

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.

Nikita Skvortsov
  • 4,768
  • 24
  • 37
  • Thanks! Looks like what I'm looking for. I'll give it a try and get back. One question, though: should Deploy have "finish build trigger" towards Build? or is it enough to have VCS trigger + Snapshot Dependency? – Yan Sklyarenko Nov 23 '15 at 09:07
  • No, you do not need `Deploy` to have finish build trigger. TeamCity will trigger deploy based on VCS trigger and will make sure it is linked with proper `Build` instance (either re-built, or re-used if applicable and configured in snapshot dependency settings) – Nikita Skvortsov Nov 23 '15 at 12:58
  • Works like a charm! Thanks a lot! – Yan Sklyarenko Nov 23 '15 at 13:59