TeamCity - can I cancel the currently running builds of the same configuration when starting a new build?

I have several lengthy integration tests that are automatically run by the TeamCity server when I take control of the source code.

TeamCity allows me to prevent these tasks from including all build agents at the same time, limiting simultaneous assemblies, however, I wonder if TeamCity can cancel any currently running tasks of this configuration when starting a new one?

In this environment, as soon as a new source commit appears, the old runs of integration tests do not matter, so I donโ€™t want the server to waste time running tests for older versions.

+6
source share
3 answers

I do not think this is possible, and I would say that it is by design.

Imagine a world where it is allowed, you will never know which of the bones made the test fail. If you had enough overlapping commits, you could have 50 builds before you know that the final test that will be run will fail and had no idea if this was the last commit or what it was before how it ended.

IMHO, you'd better focus on making several launches simultaneously on different servers in order to speed up, rather than throwing a child with water in the bathroom.

UPDATE

Although I do not think this is supported out of the box, if I had to do it, I would have thought that I look receipt of the notification, when the assembly (it seems there is no notification that the assembly is in the queue, so you need to allow multiple assemblies work at the same time for this to work), and then you can use the API to undo other assemblies:.

you can get the list of assemblies using the API so that it can undo all those that are not the last

+1
source

No, It is Immpossible. You can cancel it manually. Or you can add a quiet period (60 seconds by default), so the build does not start immediately when something has been pressed. Then, if some commits appear in a few seconds or minutes, they will be included in the TeamCity assembly.

+1
source

My solution is similar to updating Sam , but I would use a โ€œpreambleโ€ configuration, which is triggered by commits to the original control. This work is solely responsible for verifying that any of your integration test tasks have already been completed and stopping them by calling the REST API , if necessary.

Basic integration tests are performed from a special job configuration that uses a build completion trigger associated with the preamble configuration.

In this setting, itโ€™s quite simple to ask which tasks are being performed, and you may need to cancel them if a new job is done. So the steps are:

  • Preamble - Cancel any running integration test run initiated by VCS
  • Integration Test - Initiated by the completion of the Preamble assembly
-1
source

Source: https://habr.com/ru/post/981664/


All Articles