I have a step that deploys a nuget package (no custom install folder). It has a custom powershell scrip that attempts to copy the extracted package files to a target folder identified by a project variable. Unfortunately, the $OctopusParameters[‘Octopus.Action[Deploy Report Manager Package].Output.Package.InstallationDirectoryPath’] variable just evaluates to an empty string. My powershell script is the same step as the nuget package so not sure why this is not working.
Write-Host “Copying Report Manager dll’s…”
$source=$OctopusParameters[‘Octopus.Action[Deploy Report Manager Package].Output.Package.InstallationDirectoryPath’] + “*.dll”
$dest=$ReportManagerDirectory + ""
cp $source $dest -Force
Source evaluates to “*.dll”
Also, this step is a nuget package deploy step with out of package deploy script and no custom installation directory. I just need to get the folder where the files were extracted so my powershell script can copy to ultimate destination.
Thanks for getting in touch! The output variables aren’t available until after the step has completed. You should be able to use ‘OctopusOriginalPackageDirectoryPath’ in this case.
Let me know how this goes.
Vanessa, that did the trick. One oddity though. I didn’t see OctopusOriginalPackageDirectoryPath in the variable browser list.
Also, how do you properly concatenate the following when writing to the Octopus out stream?
Write-Host "OctopusOriginalPackageDirectoryPath = " + $OctopusParameters[‘OctopusOriginalPackageDirectoryPath’]
The output includes the plus sign which I don’t want.
The variable is only available for a really short time, for Octopus itself, in the package step, on the machine. So it won’t be in the list. But for your needs it’s perfect.
For your PS issue we would recommend, defining it as a PS var to get around the quotes and + issues so:
$PackageDirectoryPath = $OctopusParameters['OctopusOriginalPackageDirectoryPath']
Write-Host "OctopusOriginalPackageDirectoryPath = $PackageDirectoryPath"
Vanessa, do you have any suggestions on this permissions issue in Octopus?
I’ll add the ticket to my list and see what I can find.