cleanup all files EXCEPT git folder before compile
Currently, our build option for “Delete all files in the checkout directory before the build” translates to be either:
- Don't clean up anything, use a dirty repo and cross your fingers.
- Clean up everything, including the git folder.
The 1st option is faster, as it doesn't need to clone the repo, however comes with risk, if clutter is left over from previous builds, it may pick up a reference that isn't there on a clean build (we had this exact issue).
The 2nd option is safer, but much slower. Our git server is in a different country, and results in slow build times, and lots of external VPN traffic.
What we are after is a halfway house. Clean everything EXCEPT the git folder. Is this possible in the build settings in TeamCity, without having a manual “git clean -xdf” as our first task?
Please sign in to leave a comment.
Please see the Agent Settings for the VCS Root: https://www.jetbrains.com/help/teamcity/2024.07/git.html#GitAgentSettings.
1. You can use mirrors and use clean checkout. Clean checkout will delete everything before the checkout, as you mention, but the mirror will remain and will speed it up.
2. You can specify a clean policy there as well. A clean policy without a clean checkout may be enough for your scenario, please check.
Best regards,
Anton
Thanks, have left the build settings to not clean, and set the VCS root setting to always clean all untracked files. That seems to be the sweetspot that we were looking for.