Files getting cleaned from agent check out directory when need for next build configuration

We have a complex native and .Net build and test set spread over multiple build configurations. The first build configuration Preliminaries, builds various C++ libraries that are needed by the rest of the build configurations. I have set up snapshot dependencies between the other configurations and Preliminaries and set the configurations to run on the same agent. All the build configurations use the same check out rule, so each build configuration will run in turn on the same directory on the same build agent.

However, it appears that build products produced by Preliminaries get deleted between builds under some agent usage patterns, for instance if a non related build configuration gets done on the agent between Preliminaries and one of the other build configurations. 

How do I stop the cleaning of files in the build directory while there are builds that need to use that directory?

I don't need these files after build so I don't what to declare them as artifacts. 

 

Thank you for your assistance.

1
3 comments
Avatar
Permanently deleted user

 

So from the blog post  https://blog.jetbrains.com/teamcity/2016/03/teamcity-take-on-build-pipelines/ , the behavior is expected. Thus build configuration can on depend on artifacts and parameters of their snapshot dependencies and not the contents of check out directory as I was hoping. 

1

Hi Chris,

Teamcity only clears a build folder when some conditions are met, by default they aren't cleaned. They can also be cleaned if you are using specific build features for that purpose, but I'm assuming you aren't. If using chekout rules, then it is true that the contents will be replaced, so if you place new content within the new checkout sources, it's likely they will remove the new content.

With this in mind, even if you don't need the artifacts published, you can always use them to pass them along within teamcity. That also will give you more freedom to not depend on running all builds in the same agent.

You can as well, of course, add an extra step to your builds that simply copies the required data somewhere safe and restores that as the first step of your second build, but that's basically what artifacts will do for you automatically.

0
Avatar
Permanently deleted user

Hi Denis, 

You statement is correct. Unfortunately on of the conditions is: Free disk space on the machine before start of build. We have a lot of different build configuration and active branches thus eventually disks get cleaned before almost every build. My problem is that there are a lot of build "artifacts" that need preserving in a complex hierarchy not the best/easiest use of TeamCity artifacts IMHO, or I could rebuild a legacy C++ MSBuild configurations. so have a more centralized directory structure.  Do you have a blog posts on artifacts that might be helpful in this case?

I have gone with a constructing a minimal set of preliminaries to run before each of the dependent builds instead as that turned out to be a easy solution with-in our current system. 

For others with the similar issues I would recommend considering the artifact based solution as it might be the better path for you.  The fundamental principle is that a build configuration should only depend on what is in a clean check out and what gets build agents can get from other servers, and not any unversioned content of the checkout / working directory. 

thank you for your assistance.

0

Please sign in to leave a comment.