Octopus Package Size

Hi,

I need to display Nuget Package Size how do we read nuget package size? is there any octopus variable for that ?

Could you please help me on this

Hi,

Thanks for getting in touch! You can get the package file path using the system variable Octopus.Tentacle.CurrentDeployment.PackageFilePath. You can then use this in a custom script in your package step and calculate its size. I’ve pasted an example below that will tell you the size in MB with 2 decimals. :slight_smile:

$FilePath = $OctopusParameters['Octopus.Tentacle.CurrentDeployment.PackageFilePath'] #Insert Octopus variable with full package path here

$FileSize = [Math]::Round((Get-Item $FilePath).Length/1mb,2)

"The size of the file [$filepath] is [$FileSize MB]"

If you instead want to use this file path in a subsequent script step, you can set it as an output variable.

I hope this helps! Let me know if you have any further questions.

Kind regards,

Kenny