I’m looking for a way to Deploy a package a bit more dynamically than how the out of the box step template for Deploying a package works.
The package name and version will not be known until deployment time, so I would like to create a custom template to Deploy a Package using the Octopus Client powershell code.
Can anyone share a code snippet of how this can be accomplished?
I haven’t been able to get this to work so far using either the Octopus.Client or direct REST calls.
I can use the Octopus.Client to get specific package details $package = $repositoryForSpace.BuiltInPackageRepository.GetPackage($packageID,$packageVersion), but can’t see any mechanism to download it.
The easiest way I can think of to achieve this would be to have the script copy the package from the repository folder location e.g. C:\Octopus\Packages\Spaces-1\feeds-builtin\<packageName>\<packageName.<version>
That is a good idea, but I think the dilemma I face is the packages are stored in a storage account in Azure and not on the Octopus server itself.
I guess I can target the storage account and try to download it, that way…But ideally i think the path of least resistance is mimicking what Octopus does in that step. Any idea if the code is available for ‘Deploy Package’ step template?