Deploy step Transfer a Package is appending the TeamCity build folder to the filename

Hi,

I’ve been trying out your new ‘Transfer a Package’ deployment step. Whilst the package is transferred to the correct location, it seems to append the TeamCity build folder to the filename.

For example, my NuGet package ‘test.nupkg’ comes up fine in the OD library, I can download it fine and it downloads as test.nupkg. But the copy of the package on my server comes up as ‘test.nupkg-e6c9118a-1704-473f-9e10-0e0280e9fb69’

I’ve also noticed that the package is saved correctly in: C:\Octopus\Packages<project> without the trailing TeamCity build folder.
I’m using TeamCity 10.0.0.4 and am using my project with OctoPack (latest version) to deploy the package to the OD library

Hope you can help me out.

Cheers,
Russ

Hi Russ,

Thanks for getting in touch. The GUID you are seeing isn’t to do with TeamCity, it’s a GUID we append when files are downloaded to the Tentacle package cache to avoid name collisions. We have an issue open already to remove this GUID for Transfer a Package steps, which you can track here https://github.com/OctopusDeploy/Issues/issues/3060, the fix will hopefully go out in our next release.

As a work around you can use the output variables listed at the bottom of the Transfer Package support page to access the package: http://docs.octopusdeploy.com/display/OD/Transfer+Package

I hope that helps.

Hi Mark,

Ha, I didn’t look closely enough at the GUID! Started much the same and I then went into assumption mode!

Happy to wait for the next release as I’m not production ready yet anyway.

Thanks,
Russ

Hi Mark,

The fix for 3060 has indeed resolved the issue with the file name for the transfer a package build step. I have however noticed that the guid is also present for the variable ‘Octopus.Tentacle.CurrentDeployment.PackageFilePath’. If this is intended, is there another variable I can use that has the package name as given by TeamCity?

Cheers,
Russ

Hi Russ,

The valid variables for package transfer steps are:

Octopus.Action[StepName].Output.Package.DirectoryPath - The directory the package was transferred to
Octopus.Action[StepName].Output.Package.FileName - The name of the package
Octopus.Action[StepName].Output.Package.FilePath - The full path to the package

The FileName one will contain <PackageId>.<PackageVersion>.<Extension> which should match the original package name sent from TeamCity, but for implementation reasons the value is recreated from the detected PackageId and PackageVersion rather than just copied. If it is different for you let me know.

I hope that helps.

HI Mark,

Thanks for the quick reply. Ok, I’ve changed the entry in my json file to reference the new variable:

“packageFilePath”: “#{Octopus.Action[Extract Files].Output.Package.FileName}”

Extract Files is the step name that I’ve been transforming the json file in, but for this variable it doesn’t get resolved! Any idea what I’m doing wrong? From your docs it shows that quotes aren’t needed around the step name, but is the space a problem?

Cheers,
Russ

Hi Russ,

The space in the step name isn’t a problem. The step name you use in the variable needs to be the step where you transfer the package, not where you are transforming the JSON, is that the problem?

If not can you send me a screenshot of how you have the step where you are transforming the package configured? And maybe a screenshot of the top level of your process just showing the steps you have?

Another thing that can help with debugging is to create two Octopus variables on your project: OctopusPrintVariables and OctopusPrintEvaluatedVariables and set them both to true then run a deployment, and the raw log of the deployment will contain the value of all variables. So you should see something like this in your raw log:

09:35:37   Verbose  |       [Octopus.Action[Transfer Package].Output.Package.DirectoryPath] = 'c:\temp'
09:35:37   Verbose  |       [Octopus.Action[Transfer Package].Output[The Machine].Package.DirectoryPath] = 'c:\temp'
09:35:37   Verbose  |       [Octopus.Action[Transfer Package].Output.Package.FileName] = 'HelloUnicode.1.0.0.zip'
09:35:37   Verbose  |       [Octopus.Action[Transfer Package].Output[The Machine].Package.FileName] = 'HelloUnicode.1.0.0.zip'
09:35:37   Verbose  |       [Octopus.Action[Transfer Package].Output.Package.FilePath] = 'c:\temp\HelloUnicode.1.0.0.zip'
09:35:37   Verbose  |       [Octopus.Action[Transfer Package].Output[The Machine].Package.FilePath] = 'c:\temp\HelloUnicode.1.0.0.zip'

which will tell you if the variable is being set correctly.

Cheers,
Mark

HI Mark,

Figured it out. I have a package deployment phase where I was doing the substitute variables for my Json file, but this was before the Transfer a Package step. Swapped them round and it’s all good now.

Thanks for your help

Cheers,
Russ