(NVM) Queue Build Chain Until Another Build Chain Finishes
Hey There,
We have all of our Build Agents running on the same server, and have two projects that are using different versions of Node, using NVM to switch between them at the start of their build, and VCS triggers to kick off builds.
However, we often run into a case where both projects are committed and pushed around the same time, which causes the following problem:
- Project 1 kicks off, using Node version 8.11.4
- Project 1 starts doing NPM Install, and other prebuild steps.
- Project 2 kicks off, switching to Node version 10.1.4
- Project 1 starts to build the actual project, but fails because of the incorrect version of Node.
Is there a way that I can tell these projects to just add to the queue until the last step is completed on the other project? I know I can use build chains and snapshot dependencies to achieve this, but I'm not interested in having them build each time the other one is committed.
Many thanks for the help!
Please sign in to leave a comment.
Hi,
I'm afraid that there is no way to prevent a chain from starting until a previous chain has finished. Having multiple agents on the same machine without proper isolation between the environments can lead to this kind of issues. Some possibilities in your situation would be:
-Run different projects on separate agents (via agent pools), pointing each project at different installations. I am unaware of NVM's ability to have multiple installations being run at the same time, so this might be slightly harder if they don't, but I'd argue that that is an issue with your specific infrastructure and NVMs requirements rather than teamcity.
-Use containers for builds instead of running them directly on the machine. This would provide proper isolation even when running on the same machine. Docker would be the first thing to come to mind, but other options such as vmware VMs would work as well. TeamCity has direct integration with them precisely to make it easier isolating environments.
-Enforce waiting manually via a script. You could set the first step of the build to check for running builds of the chain and then have it wait until the current one is stopped. It's not trivial, especially if multiple chains can be started at roughly the same time, but it's the only way to achieve what you are looking for.
Hope this helps.