Hi, I currently I am running a few git commands via the cut and paste powershell feature. I noticed that git is outputting to the powershell stderr stream? It looks like an error to powershell. Is that enough to halt the script?
I can run the script in the powershell ISE and see the red “errors” but it just continues and does the work as expected.
Thanks for any ideas
ServerTasks-405.log.txt (1 KB)
To test if the script can run successfully in Octopus you can tell Octopus to ignore any messages written to the error stream, to do this you would put the following at the top of your custom PowerShell script:
and then at the bottom of the script to turn normal error handling back on:
Because errors written to the error stream shouldn’t halt a script, they should output errors and fail the task that the script is running in.
Hope that helps!
Thank you and kind regards,
Thanks for responding Henrik!
I have cut and pasted the entire attached script into the powershell window for the step, and have included the suggested code. It
I have attached the log and the script, (dont feel you need to debug anything in there :D) You may note that I have the tags around the function calls, but I also had them at the top and bottom as suggested - same result.
ServerTasks-436.log.txt (2 KB)
GitScriptBig.ps1 (2 KB)
I am going to re-install the tentacle, aka ‘releasing the kraken’
OK, so i made sure the fingerprints were a-OK, and reduced my script down to the bare bones of a “hello world” type powershell script. I am postive that its the git command "git checkout that is writing the the strerr of powershell (expected) but even with the line Write-Host “##octopus[stderr-ignore]” in the script, it does not seem to be ignoring them
using the technique to suppress the stderr stream:
git checkout Release 2>&1 | write-host, is not honored in octopus, however it is when i run it in the terminal window.
Ok, so last post today… im losing hair now.
This line: git checkout Release *>$null
Yields different results if executed by octopusDeploy vs me (in the terminal)
Octopus will execute it as if the *>$null is not there (error, but not really its just git writing to strerr)
i can execute that and get what i expect; no feedback.
OK quick update, i dont know how but its working now.
I can add more details later.
Its time to cook.