Need to reference a text file with my script package

usability
(DealerSocket Deployment) #1

I have a deployment project with one Run a Script step that is deploying a package containing my powershell script file and a text file. I need to reference the location of the text file and pass that path, as a parameter, into my script (my script iterates over the contents of the text file).

I created a project variable called Package.FilePath with the value:
#{Octopus.Action.Package[<Package Name>].ExtractedPath}
however, it does not appear to be obtaining the actual file path value. . . The deployment continues to fail due “Missing an argument for parameter” and it appears the Package.FilePath value is literally coming through as #{Octopus.Action.Package[<Package Name>].ExtractedPath} (i.e. instead of C:\Octopus\Work\20190801…\ [package name] etc.)

Any help would be greatly appreciated. Say hello to Bob Walker for me!!

Cheers

(Daniel Fischer) #4

Hi @DealerSocketDeployment,

Thanks for getting in touch! I have some pointers which should help you out here. As this is all happening on the same step and using our reference package feature, the variable you have provided should work… I can dig further into why this is failing though I may have a quick workaround which would could be neater depending on your needs.

In the script, you should be able to directly reference the extracted directory with .\ like:

.\package\file.txt

If this is a viable option for you it could be a bit neater than using the project variable and substitution. However, I’ll dig into what could be going wrong here and if you would prefer that your current method work, let me know and I’ll see what I come up with.

If you have any further questions here, please let me know.

Best regards,
Daniel