VCS Trigger - ensure NOT triggered if certain files changed

I have a situation where, if files in a certain directory change, then I want to run job A; and if no files in that directory change, then I want to run job B. I always want to run exactly one of either job A or job B; I never want to run both.

Unfortunately, I can't find a way to set up this behavior using the VCS triggering rules, since it seems that the `:-` rules only exclude files from being considered for triggering - they don't ensure that the job is NOT triggered.

As an example - say my repository has these two directories:

jobA/
other/

Then, I have a build config, JobA, that has this vcs rule:

+:jobA/**

So far, so good - JobA will trigger if and only if files in jobA/ are modified.

Then, I try to set up JobB with this VCS trigger rule:

-:jobA/**

Unfortunately, this does not work as intended, because if a commit alters files in BOTH jobA/ AND other/, JobB will still trigger, when I want JUST JobA to run.

Is there any way to get this desired "partitioned" behavior, where EITHER JobA OR JobB is run, but never both?

2 comments
Comment actions Permalink

Hello Paul,
Does jobB depend on what is on jobA directories and viceversa? If not, you could try having different VCS checkout rules for jobB to checkout only the relevant parts.
https://www.jetbrains.com/help/teamcity/vcs-checkout-rules.html

Thank you,

Guilherme

0
Comment actions Permalink

Both jobs need the content in both directories. Also, using separate checkout rules wouldn't give the desired behavior, where if files are changed in both directories, then only jobA runs.

0

Please sign in to leave a comment.