Add a way to pass parameters when using scripts in packages
In Octopus 3.3 the option to execute a script inside of a package was added, along with a field to declare the name/path of the script.
It might be good to add an extra field (or another way) to pass parameters to these scripts, just like other tools like TeamCity, AppVeyor or TFS have.
Released as part of 3.3.21
Kevin W commented
So... is there an example of how to do this? This way doesn't seem to work "Deploy.ps1 -dbServer $SQL4"
Tim Cartwright commented
Not being able to pass in parameters to nuget scripts is extremely limiting and makes the ability to run scripts from a nuget package less than useful. I don't understand why this seemingly necessary feature would be omitted.
David White commented
I'd like to be able to run our PowerShell scripts *without modification*. We write them mostly as CmdLets with parameters and don't want to have to tweak them to take Octopus parameters (as is the case at present).
Unmodified scripts are easier to test outside of Octopus.
I would love for this to be taken one step further and be turned to Import-Module from package, and invoke a function with parameters
We have deployment and provisioning scripts for azure - and pass env-specific params to them as cli params for PS
At the same time we'd like to use scripts for engrs and run them manually when needed.
Currently if we use octopus cars inside - the latter won't be possible.
We have puppet scripts in a NuGet package that we want to execute. Currently the only way to do this is to run the following script using the 'Pre-deployment script' step:
$apply = [System.IO.Path]::Combine($OctopusParameters["Package.InstallationDirectoryPath"], 'Apply.ps1');
.$apply -Role 'Web-Server'
It would be nice if we didn't have to write the extra code above using an undocumented Octopus variable that I only discovered after asking a question in the forums.