I need to access a json file that was extracted in a previous step. I can't seem to find the correct variable for this.
For example my step called 'Get Package' will download and extract the package to a temp folder within the work folder.
I then have another step that is trying to get the contents of one of the json files that was extracted.
I have tried the following variables but both say that the file cannot be found:
$json = Get-Content $octopusparameters['Octopus.Action.Package[Get Package].ExtractedPath']\config.json -raw | ConvertFrom-Json
$json = Get-Content $octopusparameters['Octopus.Action.Package[Get Package].OriginalInstalledPath']\config.json -raw | ConvertFrom-Json
I was expecting it to go to the folder created in the 'Get Package' step and find the file but it looks in the temp folder for the step that is currently running and obviously the config file doesn't exist.
The variable may be different if you are using a Custom Directory.
If not, this should work:
$OctopusParameters["Octopus.Action[YourPreviousStepName].Output.Package.InstallationDirectoryPath"]