Reboot TeamCity Agent after build completes
I need to reboot an agent after the build completes and have it not return that the build was not canceled. I tried some of the other posts from many years ago and they do not work for me. I am running 2018.1.2.
We are running CodedUI for automated testing and I had to disable the service and have it run agent.bat upon bootup/autologin since it wouldn't work in interactive mode. But once a test is complete and works fine, any subsequent tests fail on that agent because the build no longer is running in interactive mode. The only way I can figure to fix this is to reboot at the very end of each build.
I need help ASAP. I don't know what to do to get this to work.
Thanks in advance.
Please sign in to leave a comment.
Hi Eric,
in order to get interactive sessions you need to start them with users, as you know. This said, once you get the first test through, the rest should still happen in the same interactive session, so it feels like there is something else going on. If the first *build* finishes, the next ones should still be interactive as well. I'd recommend checking what the problems actually are. Feel free to share the errors you are finding with us.
With this in mind, restarting the agent during the build while keeping the build status might be complex, but there might be a much simpler way. Set up a build with a snapshot dependency on the actual build, set it up to run on the same agent and that one just restarts the machine. You can simply ignore its results, keep the other one untouched and have the best of both worlds.