Wrong version gets deployed when OC initiated in TeamCity

Hi,
I’ve got deployment project in TeamCity it will build solution, create nuget package and ask this to be deployed to OC.
As shown in log build artifact was version 0.30 and this is given to OC yet deployed package is 0.24…
Could you advice how to make sure this wouldn’t happen?

[11:34:44]Running command: octo.exe create-release --server http://xxxxxxx/octopus/ --apikey SECRET --project Current_API --enableservicemessages --version 0.30 --deployto Testing --waitfordeployment

[11:34:44]Creating Octopus Deploy release

[11:34:44]Octopus Deploy Command Line Tool, version 2.4.5.18

[11:34:44]

[11:34:44]Handshaking with Octopus server: http://xxxxxx/octopus/

[11:34:46]Handshake successful. Octopus version: 2.5.11.614; API version: 3.0.0

[11:34:46]Finding project: Current_API

[11:34:47]Finding deployment process for project: Current_API

[11:34:47]Finding release template…

[11:34:47]Resolving NuGet package versions…

[11:34:47]Finding latest NuGet package for step: Deploy current API

[11:34:47]Using version number provided on command-line.

[11:34:47]Release plan for release: 0.30

[11:34:47]Steps:

[11:34:47] # Name Version Source

[11:34:47] — -------------------- --------------- ------------------------------------

[11:34:47] 1 Deploy current API 0.24 Latest available in NuGet repository

[11:34:47]

[11:34:47]Creating release…

[11:34:47]Release 0.30 created successfully!

[11:34:47]##teamcity[setParameter name=‘octo.releaseNumber’ value=‘0.30’]

[11:34:48]Deploying Current_Api 0.30 to: Testing (Guided Failure: Enabled)

[11:34:48]Waiting for 1 deployment(s) to complete…

[11:35:18]Deploy Current_Api release 0.30 to Testing: Success

[11:35:18]Done!

[11:35:18]Octo.exe exit code: 0

Hi Joona,

Thanks for getting in touch! Indeed, by the looks there is something funny going on. See if you can provide us the following info for us to help you troubleshooting:

  1. The raw log of the 0.30 deployment. Check this link to see how to get it http://docs.octopusdeploy.com/display/OD/Get+the+raw+output+from+a+task

  2. A screenshot of your nuget package feed where we can clearly see which versions of your package are available. The goal of this is to make sure that the latest package available is indeed 0.30 and not 0.24

Hope to hear from you soon :slight_smile:

dalmiro

Hello,

I had the same problem recently, and it was because I was creating the Octopus Release in the same build that I was generating the .nupkg file and uploading it to the TeamCity NuGet feed.

My fix was to have Build 1:

  • Build, test, etc.
  • Build .nupkg file
  • Upload .nupkg file to teamcity nuget feed

And then have Build 2:

  • Have a build trigger on Build 1
  • Have a snapshot dependency on Build 1
  • Set the build number to %dep..BuildNumber…
  • Create the Octopus Release.

I imagine that you can get around this by explicitly publishing to the TeamCity nuget feed instead of letting TeamCity automatically do it for you.

Good luck,
Sean.

Hi,
I’ve solved this by having TC to build and create nuget packages in one
build and have another build which has snapshot dependency to former.

Thank you for the support.

BR
Joona

I have had cases with version 3.2.22 where the incorrect version of the application was installed. We have multiple branches being built and releases being created. I am not sure if it was a timing issue but a newer release was deployed when the button is clicked. It was to deploy release “88” and release “89” was deployed.

The Octopus UI showed version 88 deployed but the file system on the target server had a directory name of 89 and the files in the directory matched those in the 89 release branch. The release builds were created ~1 minute apart.

After creating an 88.1 release from 88 the deployed succeeded.

Hi,

Thanks for getting in touch! How are you triggering the releases? Are you able to provide the build log for me?
I suggest that you start a new thread and mark it private or everyone already in this thread that you have responded to will see the logs.

Thanks!
Vanessa

Hi Guys

I am having a similar issue as discussed in this thread. I have two build configs on my Team City.

Build 1
Build Code
Run Tests
Deploy using Octopack

Build 2
Snapshot dependency of Build 1
Octopus Deploy : Create Release
Build Number Format : 1.0.%dep.AectutorsAccountingSystem_Build.build.counter%

When I manually trigger build 2 it always picks up an older version of the output from Build 1 and deploys it. Am I doing anything wrong or is there an TS issue or is it Octopus.

Any help would be great.

Regards

Ayaz

Hi,

Thanks for getting in touch! You can force the correct version by specifying packageversion parameter.

Please let me know how you go.

Regards,

Pawel

Hello Pawel

Thanks for the quick response. Not sure what you mean by package version but I am already passing an Octopack version as 1.0.%build.counter% to the Team City UI.
Is this what you are referring to?

Regards

Ayaz

Hello Pawel

To provide you with more context, below is an extract from team city log. I have the latest package version 1.0.68 sitting in Octopus which I have manually checked, however the deploy process is still picking up package 1.0.67 and thinks that is the latest. Please let me know if you need anything else to help me get to the bottom of this.

[Octopus Deploy] Running command: octo.exe create-release --server http://localhost:8080/OctopusServer --apikey SECRET --project DeployAECWebToTest --enableservicemessages --version 1.0.29 --channel Default --deployto AECWebserverTest01 --progress
[10:05:59][Octopus Deploy] Creating Octopus Deploy release
[10:06:00][Octopus Deploy] Octopus Deploy Command Line Tool, version 3.4.2+Branch.master.Sha.869d64eaf5d2657a5daadda886a2dd697e2a024c
[10:06:00][Octopus Deploy]
[10:06:01][Octopus Deploy] Build environment is NoneOrUnknown
[10:06:01][Octopus Deploy] Handshaking with Octopus server: http://localhost:8080/OctopusServer
[10:06:01][Octopus Deploy] Handshake successful. Octopus version: 3.5.2; API version: 3.0.0
[10:06:01][Octopus Deploy] Authenticated as: “ayazaliuk” <"ayazaliuk@hotmail.com"> “”
[10:06:01][Octopus Deploy] This Octopus Server “supports” channels
[10:06:01][Octopus Deploy] Finding project: DeployAECWebToTest
[10:06:01][Octopus Deploy] Building release plan for channel ‘Default’…
[10:06:01][Octopus Deploy] Finding deployment process…
[10:06:01][Octopus Deploy] Finding release template…
[10:06:01][Octopus Deploy] The package version for some steps was not specified. Going to try and resolve those automatically…
[10:06:01][Octopus Deploy] Finding latest package for step: “DeployWebApp”
[10:06:02][Octopus Deploy] Selected ‘“AECMIS.MVC”’ version ‘“1.0.67”’ for ‘“DeployWebApp”’
[10:06:02][Octopus Deploy] Using version number provided on command-line: 1.0.29
[10:06:02][Octopus Deploy] Release plan for DeployAECWebToTest 1.0.29
[10:06:02][Octopus Deploy] Channel: ‘Default’ (this is the default channel)
[10:06:02][Octopus Deploy] # Name Version Source Version rules
[10:06:02][Octopus Deploy] — -------------- --------- ------------------ -------------------
[10:06:02][Octopus Deploy] 1 DeployWebApp 1.0.67 Latest available Allow any version
[10:06:02][Octopus Deploy]
[10:06:02][Octopus Deploy] Creating release…
[10:06:02][Octopus Deploy] Release 1.0.29 created successfully!
[10:06:02][Octopus Deploy] ##vso[task.addattachment type=Distributedtask.Core.Summary;name=Octopus Deploy;]C:\TeamCity\buildAgent\temp\buildTmp\octo-temp\3.0\2665dc3b-8c26-42ad-9d05-465acf56f274.md
[10:06:03][Octopus Deploy] Deploying “DeployAECWebToTest” “1.0.29” to: “AECWebserverTest01” “”(Guided Failure: “Enabled”)
[10:06:03][Octopus Deploy] Waiting for 1 deployment(s) to complete…
[10:06:23][Octopus Deploy] Success: Deploy DeployAECWebToTest release 1.0.29 to AECWebserverTest01
[10:06:23][Octopus Deploy] “Deploy DeployAECWebToTest release 1.0.29 to AECWebserverTest01”: Success
[10:06:23][Octopus Deploy] Done!
[10:06:23][Octopus Deploy] Octo.exe exit code: 0

Hello Pawel

I have found more information after doing a bit of digging around. As I am using Octopack in build 1 configuration it is publishing the package to C:\Octopus\Packages[appname] however the Octopus Deployment runner is looking for the latest package within the default Octopus Nuget feed cache C:\Octopus\OctopusServer\PackageCache. In your opinion, what should I change so the publish location and source for deployment are using the same location.

Regards

Ayaz

Hi,

Thanks for getting back to me with more data. I can see in your TeamCity log that indeed you are missing packageversion parameter. Please specify it in the Additional command line arguments section. You can find more details on how to do that here.

Please let me know how you go.

Regards,

Pawel