Artifacts contain files from previous builds (checkout dir not cleaned)
I have a build configuration whose VCS settings are set to clean "all non-ignored untracked files".
In addition, i store the build's output artifacts under the checkout dir:

From the log it can be seen that the checkout dir is indeed cleaned:
[Update checkout directory (C:\TeamCity\buildAgent\work\Build_android)] Cleaning Integration in C:\TeamCity\buildAgent\work\Build_android the file set NON_IGNORED_ONLY
[12:48:45][Update checkout directory (C:\TeamCity\buildAgent\work\Build_android)] Cleaning files in C:\TeamCity\buildAgent\work\Build_android\Assets\MoonCore the file set NON_IGNORED_ONLY
[12:48:46][Update checkout directory (C:\TeamCity\buildAgent\work\Build_android)] Checkout submodules in C:\TeamCity\buildAgent\work\Build_android
Lastly, after each build i publish the build.output dir folder as artifacts. My problem is that this folder contains artifacts from previous builds.
My question is -- shouldn't the setting of cleaning all "untracked non-ignored files" clean the folder under the checkout dir, so i don't have to take care of that myself?
Please sign in to leave a comment.
Hi Lior,
The clean policy has two options, one refers to when should it be cleaned, and the other one to what should be cleaned. The "All non-ignored untracked files" is the "what", but you missed pointing out "when". Is it set to always clean them? Or to just on branch change (default)?
Yes it is set to always clean. I also attached the log which shows the clean operation
Ah, true, sorry. Another rather obvious question, all non-ignored, untracked files usually would exclude generated artifacts, as they are often in the gitignore (such as the build folder, or *.apk, etc), as they aren't untracked, but explicitly ignored. Can you confirm files that should be cleaned aren't on the ignore list? If the artifacts that should be cleaned but are not aren't either on the .gitignore or tracked, please open a request in our tracker, and if possible, please provide the .gitignore and the filenames (no need for the content) that are being generated and not cleaned: https://youtrack.jetbrains.com/issues/TW
I believe i got it. the folder itself that i'm building into isn't ignored, but we are in fact ignoring *.apk files, so those files are probably indeed counted as "ignored" and as such are not cleaned!! your question helped me figure it out :)
I guess i'll remove this from our .gitignore file and then everything should work.
That's at least what should happen, should it not, please feel free to mention it so we can take a look at it.