Hey guys,
We are having a small issue with the offline package generated files (.cmd and .ps1). Under the current implementation, it requires the command and PowerShell files to run under the same folder that they were originally dropped in, simply because absolute paths were used to invoke the PS script, and similarly the PowerShell script assumes that the working folder is the same as the scripts folder, as per the following examples.
Please note that our suggested solution even allows the command file to run under any working folder
It would be awesome if you could take our recommendation on board, so that we can stop having to tweak the files post drop.
OPTION 1
Offline Package Drop.Fewzion.Deployments-846.cmd
Currently:
"C:\Windows\system32\WindowsPowershell\v1.0\PowerShell.exe" -ExecutionPolicy Bypass -NoLogo -NoProfile -File "\\fewzion-octopus\octopus-drops\Test-Zib-Anglo\Fewzion\12.3.8\Offline Package Drop.Fewzion.Deployments-846.ps1"
Suggested:
pushd "%~dp0"
"C:\Windows\system32\WindowsPowershell\v1.0\PowerShell.exe" -ExecutionPolicy Bypass -NoLogo -NoProfile -File "Offline Package Drop.Fewzion.Deployments-846.ps1"
popd
OPTION 2
Offline Package Drop.Fewzion.Deployments-846.cmd
Currently:
"C:\Windows\system32\WindowsPowershell\v1.0\PowerShell.exe" -ExecutionPolicy Bypass -NoLogo -NoProfile -File "\\fewzion-octopus\octopus-drops\Test-Zib-Anglo\Fewzion\12.3.8\Offline Package Drop.Fewzion.Deployments-846.ps1"
Suggested:
"C:\Windows\system32\WindowsPowershell\v1.0\PowerShell.exe" -ExecutionPolicy Bypass -NoLogo -NoProfile -File "%~dp0Offline Package Drop.Fewzion.Deployments-846.ps1"
Offline Package Drop.Fewzion.Deployments-846.ps1
Currently:
If ($Result -eq 0) {
& "Calamari\Calamari.exe" run-script -script "Scripts\IIS AppPool - Stop.ps1" -variables "Variables\Offline Package Drop.Fewzion.IIS AppPool - Stop.variables.json" -sensitiveVariablesSalt ysJUItC0SJGYcZKW4P5f6w== -variables "Variables\Offline Package Drop.Fewzion.IIS AppPool - Stop.variables.json" -sensitiveVariablesPassword $Password
$Result = $LASTEXITCODE
}
Suggested:
$CurrentDir = (Split-Path -Parent $MyInvocation.MyCommand.Definition)
...
If ($Result -eq 0) {
& "$CurrentDir\Calamari\Calamari.exe" run-script -script "$CurrentDir\Scripts\IIS AppPool - Stop.ps1" -variables "$CurrentDir\Variables\Offline Package Drop.Fewzion.IIS AppPool - Stop.variables.json" -sensitiveVariablesSalt ysJUItC0SJGYcZKW4P5f6w== -variables "$CurrentDir\Variables\Offline Package Drop.Fewzion.IIS AppPool - Stop.variables.json" -sensitiveVariablesPassword $Password
$Result = $LASTEXITCODE
}
PS, also, what is the point of having “dynamic” names for the command and PowerShell files? It seams to just make them harder to use them.