TeamCity not always packaging code correctly

I recently migrated from 2017.1.2 to TeamCity 2018.1.1 (build 58406). In the past, I had noticed that there were several cases where TeamCity would completely botch a routine build and silently fail without stopping the build. In all of my build configurations I ensure that if there's an error, it stops the build to prevent future problems. I also ensure that upon all builds, it cleans all sources in the work directory to prevent pollution. 

 

Reasons for the random build failures include:

  • TC not pulling all artifacts from Git (our only VCS is GIT, specifically BitBucket)
  • TC not copying all artifacts from the work folder to wherever the build is being packaged. Upon inspection of the work directory for the build agent, you see that all of the code is present, however files just don't show up in the resulting package directories where the compiled code resides.

In all instances of these issues, I've re-run the build with the exact same revisions and it's worked just fine (though in some cases i've needed to rebuild several times). In each of these cases the build succeeds and does not alert me of any failure to find specific files, or failure to copy items.

I've been hoping that this behavior would cease with future upgrades, however it's been roughly 2 weeks since the server upgrade and I am having another instance of this case. I've been having this issue on and off since v2016 with at least 3 different projects.

 

How should I go about resolving this?

0
2 comments

Hi,

 

so this is pretty strange, and I'd like to clarify some points first:

-You refer to "pulling all artifacts from Git". What do you mean exactly? Artifacts are a very specific entity in TeamCity and it doesn't interact with the VCS at all, so with our jargon, the sentence doesn't make sense. Would it read something like "TeamCity doesn't check out all the files from the Git repository"? If not, please be more specific.

-You say "TC not copying all artifacts from the work folder to a target". How do you do the copying? TeamCity doesn't copy files manually unless you specify it somehow. Knowing how have you set up both this and the previous comment might help in pointing at what can be causing trouble.

0

Certainly! 

When I say artifacts, I am referring specifically to the source code. I realize now that's the wrong word choice. between the two issues I've listed as root causes for build failure, this one results in  80% of the reasons why a build would fail when it's not a code problem.

Copy commands are carried out via Powershell. The server is on OS 2012R2, using version 4.5 (i think that's the latest version of powershell). in my step runners I set stderr = error (instead of warn), and i have flags everywhere to say "-erroraction STOP". 

0

Please sign in to leave a comment.