Which variable to use get nuget extraction parent folder?

Hi Octo Team,

I have a step in my project that extracts a nuget in a folder.

For e.g. -
1.0 extracts in D:\Octopus\Applications\Dev\MyFooApp\1.0 &
2.0 extracts in D:\Octopus\Applications\Dev\MyFooApp\2.0

I can get this path from #{Octopus.Action[Step].Output.Package.InstallationDirectoryPath}.

However, I need to find its parent path, i.e. D:\Octopus\Applications\Dev\MyFooApp. Is there an existing variable for this? (If not, it will be ok to use …\ in its place)

Thanks,
Nikhil

Hi @Nikhil_Agrawal,

Thank you for contacting Octopus Support.

For this, I would do the following:

$PackagePath = “$($OctopusParameters[“Octopus.Action[Step].Output.Package.InstallationDirectoryPath”])”
(get-item $PackagePath).parent.Fullname

Here is this example in action:

Let me know if you think that will work for you.

Regards,
Donny

Hi @donny.bell

Thanks for reply.

Yes, this option was always available. I wanted to pass parent folder name in a parameter (without adding a step and passing value b/w steps), so was wondering if such kind of a pre-existing system variable exist which holds this value.

Thanks for your help.
Nikhil

Hi Nikhil,

There is no system variable for the parent path.
You would need to use a script to get this value.
If you don’t want to have an additional step you might be able to use the custom script feature within your deployment step and place the value into an output variable

Regards,
Paul

Thanks @paul.calvert

I have now used \..\ relative path for that. Thanks for your help.

Cheers,
Nikhil

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.