Swabra not cleaning checkout directory as expected

Recently Kirill pointed me to the Swabra plugin as a way to ensure my checkout directories are cleared of .obj files and other remnants from the previous build.  I've enabled it for all my build configurations, but it's not behaving as I expected it to.  I can't tell if this is because I don't understand what it's meant to do, or if there's a bug.

I have TC 4.5.5.  There are 5 build configs for my project, and they all share the same checkout directory.  I use snapshot dependencies to force them all to build from the same codebase.  I've configured Swabra to clean before each build, for each build configuration.

In the first configuration to build, 'common', I see this in the log:

[11:29:04]: Swabra: Scanning checkout directory D:\teamcitytest\trunk\incremental\working for newly created and modified files...
[11:29:04]: Swabra: Finished scanning checkout directory D:\teamcitytest\trunk\incremental\working for newly created and modified files: 0 object(s) deleted, 0 object(s) detected modified


But this isn't right; there are lots of leftover intermediate files from the previous build attempt, including the vc90.pch precompiled header file.  This creates a problem later:


[11:29:28]: [exec] 2>SehHandler.cpp
[11:29:28]: [exec] 2>.\SehHandler.cpp(1) : error C2859: d:\teamcitytest\trunk\incremental\working\l1\aadiag\managedaadiag.wrapper\x64\release\vc90.pdb is not the pdb file that was used when this precompiled header was created, recreate the precompiled header.

I also tried solving this problem by doing  a clean as part of my build, but that doesn't work either because the clean also cleans out the artifacts copied in by TeamCity to satisfy the artifact dependencies between my build configurations.

I'd appreciate any guidance

Thanks,

Adam
7 comments
Comment actions Permalink

I am seeing newly generated files from sln2008 runner staying with swabra enabled to clean after the build. Specifically, <ProjectDir>\x64\Release directory remains after the build. I am grabbing a few generated artifacts using artifact paths on General Settings page. Maybe swabra doesn't sweep nice if there are artifacts to be grabbed? :-) Or with newly created directories?

I see the following message sequence in the build log:

...

[15:01:00]: Process exit code: 0
[15:01:00]: Swabra: Build files cleanup will be performed after build
[15:01:00]: Publishing artifacts
[15:01:00]: [Publishing artifacts] ...
...
I looked at swabra's snapshot file, and it appeared to have the right folders and files stored. I'm running TC 5.0 EAP build 10522.
Also, why is there no verbose mode for "after build" swabra setting? It would be useful for diagnosis.
Thanks!
0
Comment actions Permalink

Hello,

Adam,

Could you please run your build configuration several times again with debug mode enabled on agent (Edit <TeamCity Agent Home>/conf/teamcity-agent-log4j.xml - remove XML comments that are marked with "DELETE THIS LINE FOR ENABLING DEBUG LOGGING" text. The file can be modified without application restart).

After doing that please post here your Swabra settings (from TeamCity web UI) and attach agent log (<TeamCity Agent Home>/logs/teamcity-agent.log) and Swabra snapshot (<TeamCity Agent Home>/temp/agentTemp).

0
Comment actions Permalink

Hello,

Oleg,

>> I am grabbing a few generated artifacts using artifact paths on General Settings page. Maybe swabra doesn't sweep nice if there are artifacts to be grabbed? :-) Or with newly created directories?

Swabra performs its operations on files after artifacts are published, so publishing isn't supposed to effect the cleanup.

>> Also, why is there no verbose mode for "after build" swabra setting? It would be useful for diagnosis.

There is no ability to log anything to build log because Swabra performs cleanup after the build whan the build is finished no build log doesn't exist any more.
In such case you can look through agent log (<TeamCity Agent Home>/logs/teamcity-agent.log), which is verbose when debug mode enabled on agent.
Could you, please, attach that log for me to determine the problem.

0
Comment actions Permalink

Hi Victory,

Thanks for your reply. I've enabled the debug mode. There is some sensitive information in the entire log file, but I got the sections for you that shows what swabra is doing. I've obfuscated folder and file names for security. What I've noticed is that the 11 objects that were deleted were under directories that were created during the build. It deleted them - great! There were also some folders and files created under existing source folders. Perhaps swabra is not realizing that, so it didn't delete them. For example, "C:\Program Files (x86)\TeamCity\buildAgent\work\6ed7121dd4bd55d4\SourceFolder1\SourceFolder2\SourceFolder3\SourceFolder4" has the source code for sln2008 runner. After build the x64 Release configuration, "C:\Program Files (x86)\TeamCity\buildAgent\work\6ed7121dd4bd55d4\SourceFolder1\SourceFolder2\SourceFolder3\SourceFolder4\x64\Release" folder was created with some binaries (dlls, libs, etc). I am grabbing some artifacts from this folder via artifact paths. Swabra didn't delete any of these binaries and x64\Release folder. Hope you can find out what's wrong!

...

[2009-11-11 10:08:22,384]  DEBUG -   jetbrains.buildServer.xmlRpc - <?xml version="1.0"?><methodCall><methodName>buildServer.log</methodName><params><param><value><![CDATA[2463]]></value></param><param><value><array><data><value><![CDATA[<?xml version="1.0" encoding="UTF-8" ?>
<jetbrains.buildServer.messages.BuildMessage1><myFlowId></myFlowId><myTimestamp>1257952099602</myTimestamp><myTypeId>BlockEnd</myTypeId><mySourceId>DefaultMessage</mySourceId><myStatus>1</myStatus><myValue ><blockName>Updating sources: server side checkout...</blockName><blockType>checkout</blockType></myValue></jetbrains.buildServer.messages.BuildMessage1>]]></value><value><![CDATA[<?xml version="1.0" encoding="UTF-8" ?>
<jetbrains.buildServer.messages.BuildMessage1><myFlowId></myFlowId><myTimestamp>1257952099602</myTimestamp><myTypeId>BlockStart</myTypeId><mySourceId>DefaultMessage</mySourceId><myStatus>1</myStatus><myValue ><blockName>Updating sources: personal build patch...</blockName><blockType>checkout</blockType></myValue></jetbrains.buildServer.messages.BuildMessage1>]]></value><value><![CDATA[<?xml version="1.0" encoding="UTF-8" ?>
<jetbrains.buildServer.messages.BuildMessage1><myFlowId></myFlowId><myTimestamp>1257952099602</myTimestamp><myTypeId>BlockEnd</myTypeId><mySourceId>DefaultMessage</mySourceId><myStatus>1</myStatus><myValue ><blockName>Updating sources: personal build patch...</blockName><blockType>checkout</blockType></myValue></jetbrains.buildServer.messages.BuildMessage1>]]></value><value><![CDATA[<?xml version="1.0" encoding="UTF-8" ?>
<jetbrains.buildServer.messages.BuildMessage1><myFlowId></myFlowId><myTimestamp>1257952099633</myTimestamp><myTypeId>BlockEnd</myTypeId><mySourceId>DefaultMessage</mySourceId><myStatus>1</myStatus><myValue ><blockName>Resolving artifact dependencies</blockName><blockType>agentResolvingArtifacts</blockType></myValue></jetbrains.buildServer.messages.BuildMessage1>]]></value><value><![CDATA[<?xml version="1.0" encoding="UTF-8" ?>
<jetbrains.buildServer.messages.BuildMessage1><myFlowId></myFlowId><myTimestamp>1257952099742</myTimestamp><myTypeId>Text</myTypeId><mySourceId>DefaultMessage</mySourceId><myStatus>1</myStatus><myValue >Swabra: Saving state of checkout directory C:\Program Files (x86)\TeamCity\buildAgent\work\6ed7121dd4bd55d4 to snapshot file C:\Program Files (x86)\TeamCity\buildAgent\temp\agentTmp\6ed7121dd4bd55d4.snapshot</myValue></jetbrains.buildServer.messages.BuildMessage1>]]></value><value><![CDATA[<?xml version="1.0" encoding="UTF-8" ?>
<jetbrains.buildServer.messages.BuildMessage1><myFlowId></myFlowId><myTimestamp>1257952100305</myTimestamp><myTypeId>Text</myTypeId><mySourceId>DefaultMessage</mySourceId><myStatus>1</myStatus><myValue >Swabra: Finished saving state of checkout directory C:\Program Files (x86)\TeamCity\buildAgent\work\6ed7121dd4bd55d4 to snapshot file C:\Program Files (x86)\TeamCity\buildAgent\temp\agentTmp\6ed7121dd4bd55d4.snapshot</myValue></jetbrains.buildServer.messages.BuildMessage1>]]></value><value><![CDATA[<?xml version="1.0" encoding="UTF-8" ?>
<jetbrains.buildServer.messages.BuildMessage1><myFlowId></myFlowId><myTimestamp>1257952100352</myTimestamp><myTypeId>Text</myTypeId><mySourceId>DefaultMessage</mySourceId><myStatus>1</myStatus><myValue >Starting build process in C:\Program Files (x86)\TeamCity\buildAgent\work\6ed7121dd4bd55d4\Common\Projects\Campbell</myValue></jetbrains.buildServer.messages.BuildMessage1>]]></value></data></array></value></param></params></methodCall>
[2009-11-11 10:08:22,399]  DEBUG -   jetbrains.buildServer.xmlRpc - <<< XML-RPC response <<<

...

[2009-11-11 10:09:33,916]  DEBUG - r.agent.impl.AgentLogProxyImpl - Send buildFinished OK

[2009-11-11 10:09:33,916]   INFO - mpl$TeamCitySpringSubConatiner - Closing jetbrains.buildServer.spring.SpringSubContainerFactroyImpl$TeamCitySpringSubConatiner@10eb535: display name [SubContext: running build context id=jetbrains.buildServer.agent.impl.AgentRunningBuildImpl@1500efd]; startup date [Wed Nov 11 10:06:25 EST 2009]; parent: org.springframework.context.support.ClassPathXmlApplicationContext@ec4a87

[2009-11-11 10:09:33,916]  DEBUG - mpl$TeamCitySpringSubConatiner - Publishing event in context [jetbrains.buildServer.spring.SpringSubContainerFactroyImpl$TeamCitySpringSubConatiner@10eb535]: org.springframework.context.event.ContextClosedEvent[source=jetbrains.buildServer.spring.SpringSubContainerFactroyImpl$TeamCitySpringSubConatiner@10eb535: display name [SubContext: running build context id=jetbrains.buildServer.agent.impl.AgentRunningBuildImpl@1500efd]; startup date [Wed Nov 11 10:06:25 EST 2009]; parent: org.springframework.context.support.ClassPathXmlApplicationContext@ec4a87]

[2009-11-11 10:09:33,916]  DEBUG - ctories.CleanupRegistryCleaner - --- Clean .old folders started

[2009-11-11 10:09:33,916]   INFO - ctories.CleanupRegistryCleaner - Start deleting files from C:\Program Files (x86)\TeamCity\buildAgent\work\.old

[2009-11-11 10:09:33,932]  DEBUG - ains.buildServer.swabra.Swabra - Swabra: Build files cleanup is performed after build

[2009-11-11 10:09:33,932]  DEBUG - erver.agent.impl.GuardedAction - runGuarded finish jetbrains.buildServer.agent.impl.BuildRunAction$1$1@1e940a6

[2009-11-11 10:09:34,104]   INFO - ains.buildServer.swabra.Swabra - Swabra: Scanning checkout directory C:\Program Files (x86)\TeamCity\buildAgent\work\6ed7121dd4bd55d4 for newly created and modified files...

[2009-11-11 10:09:34,119]  DEBUG - ains.buildServer.swabra.Swabra - Deleting C:\Program Files (x86)\TeamCity\buildAgent\work\6ed7121dd4bd55d4\Folder1

[2009-11-11 10:09:34,119]  DEBUG - ains.buildServer.swabra.Swabra - Deleting C:\Program Files (x86)\TeamCity\buildAgent\work\6ed7121dd4bd55d4\Folder1\Folder2

[2009-11-11 10:09:34,119]  DEBUG - ains.buildServer.swabra.Swabra - Deleting C:\Program Files (x86)\TeamCity\buildAgent\work\6ed7121dd4bd55d4\Folder1\Folder2\Folder3

[2009-11-11 10:09:34,119]  DEBUG - ains.buildServer.swabra.Swabra - Deleting C:\Program Files (x86)\TeamCity\buildAgent\work\6ed7121dd4bd55d4\Folder1\Folder2\Folder3\Folder4

[2009-11-11 10:09:34,119]  DEBUG - ains.buildServer.swabra.Swabra - Deleting C:\Program Files (x86)\TeamCity\buildAgent\work\6ed7121dd4bd55d4\Folder1\Folder2\Folder3\Folder4\Folder5

[2009-11-11 10:09:34,119]  DEBUG - ains.buildServer.swabra.Swabra - Deleting C:\Program Files (x86)\TeamCity\buildAgent\work\6ed7121dd4bd55d4\Folder1\Folder2\Folder3\Folder4\Folder5\Folder6

[2009-11-11 10:09:34,119]  DEBUG - ains.buildServer.swabra.Swabra - Deleting C:\Program Files (x86)\TeamCity\buildAgent\work\6ed7121dd4bd55d4\Folder1\Folder2\Folder3\Folder4\Folder5\Folder6\64bit

[2009-11-11 10:09:34,119]  DEBUG - ains.buildServer.swabra.Swabra - Deleting C:\Program Files (x86)\TeamCity\buildAgent\work\6ed7121dd4bd55d4\Folder1\Folder2\Folder3\Folder4\Folder5\Folder6\64bit\file1.dll

[2009-11-11 10:09:34,119]  DEBUG - ains.buildServer.swabra.Swabra - Deleting C:\Program Files (x86)\TeamCity\buildAgent\work\6ed7121dd4bd55d4\Folder1\Folder2\Folder3\Folder4\Folder5\Folder6\64bit\file2.mexw64

[2009-11-11 10:09:34,119]  DEBUG - ains.buildServer.swabra.Swabra - Deleting C:\Program Files (x86)\TeamCity\buildAgent\work\6ed7121dd4bd55d4\Folder1\Folder2\Folder3\Folder4\Folder5\Folder6\64bit\file3.dll

[2009-11-11 10:09:34,119]  DEBUG - ains.buildServer.swabra.Swabra - Deleting C:\Program Files (x86)\TeamCity\buildAgent\work\6ed7121dd4bd55d4\Folder1\Folder2\Folder3\Folder4\Folder5\Folder6\64bit\file4.dll

[2009-11-11 10:09:34,119]   INFO - ains.buildServer.swabra.Swabra - Swabra: Finished scanning checkout directory C:\Program Files (x86)\TeamCity\buildAgent\work\6ed7121dd4bd55d4 for newly created and modified files: 11 object(s) deleted, 0 object(s) detected modified

[2009-11-11 10:09:34,463]  DEBUG -    jetbrains.buildServer.AGENT - Agent ping from server

[2009-11-11 10:09:37,948]   INFO - ctories.CleanupRegistryCleaner - Stop deleting files from C:\Program Files (x86)\TeamCity\buildAgent\work\.old. 7643 file(s) were deleted.  

[2009-11-11 10:09:37,948]   INFO - ctories.CleanupRegistryCleaner - Start deleting files from C:\Program Files (x86)\TeamCity\buildAgent\temp\.old

[2009-11-11 10:09:38,027]   INFO - ctories.CleanupRegistryCleaner - Stop deleting files from C:\Program Files (x86)\TeamCity\buildAgent\temp\.old. 7 file(s) were deleted.  

[2009-11-11 10:09:38,027]  DEBUG - ctories.CleanupRegistryCleaner - --- Clean .old folders finished

0
Comment actions Permalink

Victory,

I've tested the new plugin, and it works as expected now. Thank you so much for fixing it! I'm putting it to use with our production install right now!

Will swabra come bundled with 5.0 official release or will we need to add it by hand?

Thanks,

Oleg.

0
Comment actions Permalink

Swabra plugin still needs some polishing so it won't be included in 5.0.

0

Please sign in to leave a comment.