Team City does new build, Octopus Deploy pushes old build

Greetings,

I could use some assistance.

We’re taking another long look at a TeamCity + Octopus Deploy solution for CI . i have things set to build our product, create the a NuGet package, then push to Octopus Deploy via the TeamCity plugin (coupled with the NuGet feed). Things were great (i.e. new auto-build, package, push, update servers, run tests). I did a demo to our team and we got rave reviews.

I then upgraded Octopus Deploy and then Tentacles from 2.6 to 3.2 (and installed the updated TeamCity plugin) and now things are “stuck” — Octopus Deploy gets notified of the new package but then acquires an older package not the newly built one.

My guess is I am missing or messed up a critical configuration piece or that need to clear something some cached whatever, but am stumped as to what that may be.

Here is the relevant section from the TeamCity log:

[08:59:51]Skip checking for changes - changes are already collected
[08:59:52]Clearing temporary directory: D:\TeamCity\buildAgent\temp\buildTmp
[08:59:52]Publishing internal artifacts (5s)
  [08:59:57][Publishing internal artifacts] Publishing 1 file using [ArtifactsCachePublisher]
  [08:59:57][Publishing internal artifacts] Publishing 1 file using [WebPublisher]
[08:59:52]Checkout directory: D:\TeamCity\buildAgent\work\27f84e3eca3a33d5
[08:59:52]Step 1/1: OctopusDeploy: Create release (20m:40s)
  [08:59:52][Step 1/1] Octopus Deploy (20m:39s)
    [08:59:52][Octopus Deploy] Running command:   octo.exe create-release --server http://testbench:7968 --apikey SECRET --project Auto-CI for Qs98 --enableservicemessages --version 883.36817 --deployto Staging --progress --deploymenttimeout=00:45:00
    [08:59:52][Octopus Deploy] Creating Octopus Deploy release
    [08:59:53][Octopus Deploy] Octopus Deploy Command Line Tool, version 3.2.0.97
    [08:59:53][Octopus Deploy] 
    [08:59:54][Octopus Deploy] Handshaking with Octopus server: http://testbench:7968
    [08:59:57][Octopus Deploy] Handshake successful. Octopus version: 3.2.2; API version: 3.0.0
    [08:59:57][Octopus Deploy] Authenticated as: Rob Weigel 
    [08:59:57][Octopus Deploy] Finding project: Auto-CI for Qs98
    [08:59:57][Octopus Deploy] Finding deployment process for project: Auto-CI for Qs98
    [08:59:57][Octopus Deploy] Finding release template...
    [08:59:57][Octopus Deploy] Resolving NuGet package versions...
    [08:59:57][Octopus Deploy] Finding latest NuGet package for step: Upgrade Qs98 VEND services
    [08:59:58][Octopus Deploy] Finding latest NuGet package for step: Upgrade Qs98 GATE services
    [09:00:00][Octopus Deploy] Using version number provided on command-line.
    [09:00:00][Octopus Deploy] Release plan for release:  883.36817
    [09:00:00][Octopus Deploy] Steps: 
    [09:00:00][Octopus Deploy]   #   Name             Version     Source                
    [09:00:00][Octopus Deploy]   --- ---------------------------- --------------- ------------------------------------
    [09:00:00][Octopus Deploy]   1   Upgrade Qs98 VEND services   876.36783     Latest available in NuGet repository
    [09:00:00][Octopus Deploy]   2   Upgrade Qs98 GATE services   876.36783     Latest available in NuGet repository
    [09:00:00][Octopus Deploy] 
    [09:00:00][Octopus Deploy] Creating release...
    [09:00:00][Octopus Deploy] Release 883.36817 created successfully!
    [09:00:00][Octopus Deploy] ##teamcity[setParameter name='octo.releaseNumber' value='883.36817']
    [09:00:01][Octopus Deploy] Deploying Auto-CI for Qs98 883.36817 to: Staging (Guided Failure: Not Enabled)
    [09:00:01][Octopus Deploy] Waiting for 1 deployment(s) to complete....
    [09:01:01][Octopus Deploy] Success: Step 1: Stop Qs98 GATE services
    [09:03:23][Octopus Deploy] Success: Step 2: Stop Qs98 VEND services
    [09:03:34][Octopus Deploy] Success: Acquire packages
      [09:03:34][Success: Acquire packages] Acquiring packages
      [09:03:34][Success: Acquire packages] Making a list of packages to download
      [09:03:34][Success: Acquire packages] All packages have been acquired
      [09:03:34][Success: Acquire packages] Success: QS98GATEPRE01
        [09:03:34][Success: QS98GATEPRE01] Success: Upload package qsci_build 876.36783
          [09:03:34][Success: Upload package qsci_build 876.36783] Uploading package qsci_build 876.36783
          [09:03:34][Success: Upload package qsci_build 876.36783] Beginning streaming transfer of qsci_build.876.36783.nupkg-9c35a23c-0b59-4d8d-919d-fe53ab4a346c
          [09:03:34][Success: Upload package qsci_build 876.36783] Stream transfer complete
      [09:03:34][Success: Acquire packages] Success: QS98VENDPRE01
        [09:03:34][Success: QS98VENDPRE01] Success: Upload package qsci_build 876.36783
          [09:03:34][Success: Upload package qsci_build 876.36783] Uploading package qsci_build 876.36783
          [09:03:34][Success: Upload package qsci_build 876.36783] Beginning streaming transfer of qsci_build.876.36783.nupkg-ac1599a3-3c94-4e2c-9ee1-b789e75a2f52
          [09:03:34][Success: Upload package qsci_build 876.36783] Stream transfer complete
    [09:04:14][Octopus Deploy] Success: Step 3: Upgrade Qs98 VEND services
    [09:04:24][Octopus Deploy] Success: Step 4: Upgrade Qs98 GATE services
    [09:04:24][Octopus Deploy] Success: Apply retention policy on Tentacles
    [09:13:44][Octopus Deploy] Success: Step 5: Restart Qs98 VEND services
    [09:20:32][Octopus Deploy] Success: Step 6: Restart Qs98 GATE services
    [09:20:32][Octopus Deploy] Deploy Auto-CI for Qs98 release 883.36817 to Staging: Success
    [09:20:32][Octopus Deploy] Done!
    [09:20:32][Octopus Deploy] Octo.exe exit code: 0
[09:20:32]Publishing internal artifacts
  [09:20:32][Publishing internal artifacts] Publishing 1 file using [ArtifactsCachePublisher]
  [09:20:32][Publishing inte

Note I edited server names, usernames and domains in the above…

Looking at the Octopus Deploy log files, looks like I passed in the correct name of the build but must not be passing the correct name of the package that needs to be pushed; in this example the build was 883.36817 yet the deployment was for 876.36783. i can confirm that TeamCity is correctly building and packaging a newer version and then correctly arching the NuGet package in our TeamCityArtifacts directory.

Task ID:        ServerTasks-816
Task status:    Success
Task queued:    Friday, December 04, 2015 9:00 AM
Task started:   Friday, December 04, 2015 9:00 AM
Task duration:  20 minutes
Server version: 3.2.2+Branch.master.Sha.29e931784876074d4e4fa3d0565aeb3186861000

                    | == Success: Deploy Auto-CI for Qs98 release 883.36817 to Staging ==
09:00:01   Verbose  |   Guided failure is not enabled for this task
09:20:24   Info     |   The deployment completed successfully.

...cut for brevity...

                    |   == Success: Acquire packages ==
09:03:20   Info     |     Acquiring packages
09:03:20   Info     |     Making a list of packages to download
09:03:20   Verbose  |     Checking package cache for package qsci_build 876.36783
09:03:20   Verbose  |     Package qsci_build version 876.36783 was found in cache. No need to download. Using file: D:\OctopusData\OctopusServer\PackageCache\feeds-teamcity-packages\qsci_build.876.36783_229080BE0087124BAE9CD5C5F12A4177.nupkg
09:03:20   Verbose  |     SHA1 hash of package qsci_build is: ecdf71ffe5e9a23f665eaf0a809e1d5ffe0c31e3
09:03:25   Info     |     All packages have been acquired
09:03:25   Verbose  |     Acquire Packages completed
                    |   
                    |     Success: QS98GATEPRE01
                    |     
                    |       Success: Upload package qsci_build 876.36783
09:03:21   Verbose  |         Octopus Deploy: Calamari version 3.1.5+Branch.master.Sha.6f4ce9c6d5de736661f5f431313a6c5341cef00f
09:03:22   Verbose  |         Octopus Deploy: Calamari version 3.1.5+Branch.master.Sha.6f4ce9c6d5de736661f5f431313a6c5341cef00f
09:03:22   Verbose  |         Package qsci_build version 876.36783 hash ecdf71ffe5e9a23f665eaf0a809e1d5ffe0c31e3 has not been uploaded.
09:03:22   Verbose  |         Finding earlier packages that have been uploaded to this Tentacle.
09:03:23   Verbose  |         No earlier packages for qsci_build has been uploaded
09:03:23   Info     |         Uploading package qsci_build 876.36783
09:03:23   Verbose  |         Requesting upload...
09:03:23   Info     |         Beginning streaming transfer of qsci_build.876.36783.nupkg-9c35a23c-0b59-4d8d-919d-fe53ab4a346c
09:03:24   Info     |         Stream transfer complete
                    |       
                    |     Success: QS98VENDPRE01
                    |     
                    |       Success: Upload package qsci_build 876.36783
09:03:21   Verbose  |         Octopus Deploy: Calamari version 3.1.5+Branch.master.Sha.6f4ce9c6d5de736661f5f431313a6c5341cef00f
09:03:22   Verbose  |         Octopus Deploy: Calamari version 3.1.5+Branch.master.Sha.6f4ce9c6d5de736661f5f431313a6c5341cef00f
09:03:23   Verbose  |         Package qsci_build version 876.36783 hash ecdf71ffe5e9a23f665eaf0a809e1d5ffe0c31e3 has not been uploaded.
09:03:23   Verbose  |         Finding earlier packages that have been uploaded to this Tentacle.
09:03:23   Verbose  |         No earlier packages for qsci_build has been uploaded
09:03:23   Info     |         Uploading package qsci_build 876.36783
09:03:23   Verbose  |         Requesting upload...
09:03:23   Info     |         Beginning streaming transfer of qsci_build.876.36783.nupkg-ac1599a3-3c94-4e2c-9ee1-b789e75a2f52
09:03:25   Info     |         Stream transfer complete
                    |       
                    |   == Success: Step 3: Upgrade Qs98 VEND services ==
09:04:05   Verbose  |     Upgrade Qs98 VEND services completed

...cut again for brevity...

                    |   == Success: Apply retention policy on Tentacles ==
09:04:15   Info     |     Apply retention policies...
09:04:15   Verbose  |     Tentacle retention policy set to 'keep all'
09:04:15   Verbose  |     Apply Tentacle Retention Policy completed

I did try manually deleting the package contents within the \Files\ directory in the Tentacle Agents and then restart, but another full CI run redeployed the old build yet again.

Any assistance you can offer would would be greatly appreciated.

Thanks!

Rob

Hi Rob,

Thanks for getting in touch! If you see from your build logs, this is the FINAL thing TeamCity does: [09:20:32]Publishing internal artifacts
With TeamCity it doesn’t release its packages to its own feed until everything else in your build is done, that is why they arent available for the release.
the only way to combat this is to create two build steps … One to create and publish the artifacts then another to create your releases.

Our TeamCity videos explain this: https://octopus.com/videos See TeamCity Built in Feed and Triggering Deployments from TeamCity
(We also mention it in the TC documentation)

Hope that helps!
Vanessa