We have a central machine that runs all of our powershell scripts. From that machine, we would normally run a script from a powershell window as such:
./deploy-product.ps1 –App Appname –Environment Dev –Deploy –BatchSize 5 –DrainF5
or:
./deploy-product.ps1 –App Appname –Environment Test –Deploy –BatchSize 5 –DrainF5
or:
./deploy-product.ps1 –App Appname –Environment Prod –Deploy –BatchSize 5 –DrainF5
Essentially what I’m trying to do is get Octopus deploy, as a web front end, to call these powershell scripts on the remote machine. It works great, using the following deployment process: Run a PowerShell script across machines in roles: admin
d:\apps\scripts\deploy\deploy-product.ps1 –App Appname –Environment Dev –Deploy –BatchSize 5 –DrainF5
What I would like to do is use a Library Variable set to specify the “-Environment” variable in the command above, like the following:
Name: Value: Scope:
Env -Environment Prod machine1; admin; Prod PS
Env -Environment Test machine1; admin; TestPS
Env -Environment Dev machine1; admin; Dev PS
I’d like to call the correct environment, depending on which Environment is selected for the release, as specified by the Env variable. The following, and various other things I’ve tried, doesn’t work, and I don’t seem to be able to pass the Env variable to the powershell script:
d:\apps\scripts\deploy\deploy-product.ps1 –App Appname $env –Deploy –BatchSize 5 –DrainF5
Is there a way to pass a tentacle.exe parameter, that will recognize the $env global Library variable to the powershell script?
Thanks in advance.