Swabra always forces clean checkout

Answered

Hi, i use swabra build files cleaner.

Every build at the beggining i get message from swabra: [Swabra] Checkout directory state is unknown. Need a clean checkout directory snapshot - forcing clean checkout

Checkout directory is unknown everytime i run build. It causes clean checkout removing folders i exclude from swabra cleaning like nuget packages.

Where can be the problem? Thanks.

0
9 comments

Hi Sanjuro, 

what checkout mode do you use (agent or server-side), do you use a custom checkout directory? Also, it's also good to check teamcity-agent.log file for any errors. 

0
Avatar
Permanently deleted user

Hi,

i use checkout mode always on agent with custom checkout directory.

Thanks.

0

Do you see any errors/warnings in the agent logs? 

0
Avatar
Permanently deleted user

I can't see any warning or errors in log. Actually this build uses one snapshot dependency that checkouts to same custom directory. Both dependencies need to checkout same VCS dir.

Here is part of log output:

[2019-07-08 16:29:41,164]   INFO -    jetbrains.buildServer.AGENT - Starting Build {id=7472, buildTypeId='NpzPublish', buildTypeInternalId='bt49', personal=false, checkoutType=ON_AGENT} 
[2019-07-08 16:29:41,164] INFO - mpl$TeamCitySpringSubContainer - Refreshing SubContext: running build context id=7472: startup date [Mon Jul 08 16:29:41 CEST 2019]; parent: jetbrains.buildServer.agent.AgentMain2$2@1ef968d
[2019-07-08 16:29:41,337] INFO - uildStages.BuildStagesExecutor - Call stage jetbrains.buildServer.agent.impl.buildStages.startStages.LogAgentParametersStage
[2019-07-08 16:29:41,338] INFO - uildStages.BuildStagesExecutor - Call stage jetbrains.buildServer.agent.impl.buildStages.startStages.ClearExpiredBuildWorkingDirectoriesStage
[2019-07-08 16:29:41,392] INFO - l.directories.DirectoryMapImpl - Cleaning up old checkout directories. Default lifetime = 192 hour(s)
[2019-07-08 16:29:41,414] INFO - r.artifacts.impl.HttpDiskCache - Cleaning up items with life time in cache greater than 172800 seconds
[2019-07-08 16:29:41,414] INFO - r.artifacts.impl.HttpDiskCache - Finished cleaning up expired items, 0 items removed
[2019-07-08 16:29:41,414] INFO - dDirectoryBasedCleanupRegistry - Removing files from C:\TeamCity\buildAgent\work\.old
[2019-07-08 16:29:41,440] INFO - uildStages.BuildStagesExecutor - Call stage jetbrains.buildServer.agent.impl.buildStages.startStages.UpdateDirectoryMapStage
[2019-07-08 16:29:41,488] INFO - uildStages.BuildStagesExecutor - Call stage jetbrains.buildServer.agent.impl.buildStages.startStages.RegisterPropertiesFileNamesStage
[2019-07-08 16:29:41,498] INFO - uildStages.BuildStagesExecutor - Call stage jetbrains.buildServer.agent.impl.buildStages.startStages.FireBuildStartedStage
[2019-07-08 16:29:41,520] INFO - l.directories.DirectoryMapImpl - Cleaning up old checkout directories. Default lifetime = 192 hour(s)
[2019-07-08 16:29:41,566] INFO - uildServer.swabra.SwabraLogger - C:\TeamCity\buildAgent\work\NPZ directory state is UNKNOWN
[2019-07-08 16:29:41,569] INFO - uildServer.swabra.SwabraLogger - Checkout directory state is unknown. Need a clean checkout directory snapshot - forcing clean checkout
0

It isn't recommended to share a custom checkout directory between build configurations with different VCS settings. In this case, a clean checkout on each build is an expected and documented behavior. Please check the documentation - https://www.jetbrains.com/help/teamcity/build-checkout-directory.html#BuildCheckoutDirectory-Customcheckoutdirectory.

0
Avatar
Permanently deleted user

I made changes and now both configurations use auto checkout directory. But the problem is same. First configuration installs some NPM packages to node_modules. Swabra in second build configuration forces clean checkout as in previous situation. Swabra just force clean checkout, creates snapshot, deletes files after build comparing to that snapshot, but new build again, forces clean checkout deleting node_modules and so on. At this state it is unusable. Exactly what conditions can cause forced clean checkout on Swabra?

0

You can read more about Swabra here and here more about automatic clean checkout. 

Could you maybe attach screenshots for VCS roots\Swabra settings in both build configurations? It'll help with the investigation. 

0
Avatar
Permanently deleted user

First build configuration dont use swabra. It just npm install some packages, run script and updates teamcity parameter. Second one that depends on first one use swabra. Second one actually builds .net core app. I followed links u provided. What i finally did, i added swabra to the first build configuration with same settings as in second one despite i dont need it there. But now it finally works as expected. So it is obviously problem for swabra if one configuration has no swabra and other has in one build chain, it is little weird, but finally it works.

Many thanks for your help.

0

Glad to hear that you solved your problem. 

Swabra stores a directory state from the previous build. If, after that build, any files were changed (e.g. new dependencies were installed by npm) Swabra performed a clean checkout because this new state is unknown for it. Unless you add the same build feature to all builds working with the same checkout directory.

0

Please sign in to leave a comment.