It seems that TeamCity does not wait for artifacts to be completely uploaded before executing the next build step.
Has anyone written a TeamCity build script that uploads an Artifact to an external repository (Artifactory or Nexus) and then immediately execute another build step that downloads that Artifact from the repository?
This being more of a TeamCity question, perhaps I should post to their support forum.
I am using TeamCity to create three Nuget packages using MSBuild and *.nuspec files. The TeamCity step automatically uploads the nupkg files to Artifactory via the TeamCity Artifactory plugin.
The next three TeamCity build steps use the Octopus Deploy plugin to create a release for each of these nupkg files.
The problem is the first one.
The first Octopus Deploy create release build step does not see the recently-created nupkg file and instead grabs the previous version.
The second and third work fine.
It appears to be some sort of race condition.
To illustrate, here is what is happening.
- TeamCity Step 1
- Create V.60 server nupkg
- Create V.60 Client nupkg
- Create V.60 Standalone nupkg
- Upload all 3 nupkg files to Artifactory
- TeamCity Step 2
- Create Octopus Release V.60 for Server, grabbing the most recent version of the Server nupkg file from the repo
- TeamCity Step 3
- Create Octopus Release V.60 for Client, grabbing the most recent version of the Server nupkg file from the repo
- TeamCity Step 4
- Create Octopus Release V.60 for Standalone, grabbing the most recent version of the Server nupkg file from the repo
We end up with
- Octopus Release V.60 Server contains V.59 Server nupkg file
- Octopus Release V.60 Client contains V.60 Client nupkg file
- Octopus Release V.60 Standalone contains V.60 Standalone nupkg file
I am struggling with how to debug this race condition.
Perhaps the TeamCity artifactory plugin does not actually wait for artifacts to complete their upload before starting the next build step.
I will try to insert a PowerShell script to sleep for 10 seconds in between and see if that solves the issue.
Any and all advice is appreciated.