Help with checkout directory and branches
Hi, I use teamcity to manage the CI of a game developed in Unreal. Because an Unreal game has hundreds of GB, I always use a common checkout directory to avoid having to re-download those GB or to be able to cache the compilation/shaders...etc.
I want to have support for branches, so I want each checkout depending on the branch to go to one directory or another.
The first thing I have thought is to use %teamcity.build.branch% in the Checkout Directory field. The problem is that I use PlasticSCM and the branches are /Main and /Main/BranchA. So when the directory is created, it creates a folder structure for me. The problem with this is that it creates Main folder and then inside BranchA.
Project
Project/Main
Project/Main/BranchA
It's not a good idea to have the directories nested and I even think Teamcity can cause the checkout directory to be cleaned up and that's something I want to avoid.
Another way I thought is to use a bootstrap step to do a replace of the branch and change “/” for “_”. Set an environment variable and that is the one I put in the checkout dir. But this doesn't seem to work, as the directory creates with the default variable value even before I modify this variable in the bootstrap.
I can't think of any more ideas and I don't know if there is anything I can do to get what I want.
Something like this:
Project_Main
Project_Main_BranchA/
Thanks, best regards
Javi
Please sign in to leave a comment.
The checkout happens before the build starts, so the directories are created with the default value as you described.
Here are a couple of things to consider:
1. You can explicitly set TeamCity to not clean up the checkout directory: https://www.jetbrains.com/help/teamcity/build-checkout-directory.html#Checkout+Directory+Expiration
You should use the `system.teamcity.build.checkoutDir.expireHours=never` build configuration property (https://www.jetbrains.com/help/teamcity/configuring-build-parameters.html).
Please note that the content of the checkout directory (even if the custom directory is used) can be deleted by TeamCity under certain circumstances (https://www.jetbrains.com/help/teamcity/clean-checkout.html#Automatic+Clean+Checkout).
2. You can disable the automatic checkout and then perform the checkout in the build step: https://www.jetbrains.com/help/teamcity/vcs-checkout-mode.html
Best regards,
Anton
Hi Anton,
Thanks for the response.
I didnt know about the
system.teamcity.build.checkoutDir.expireHours=never
, thats super useful, thanks.I guess I will have to checkout manually then, I was trying to find something more automated, but that option works for me too.
Thanks,
Javi