Manual Intervention Step Instructions formatting

Hi there.

I have a powershell script that use Set-OctopusVariable function to set the value of a function as a multiline string.

When I do this from bash it works fine, but when I do it from PowerShell the EOL is not respected and the output in the Manual Intervention step is very difficult to read.

The code responsible in bash is

terragrunt plan -destroy -no-color -out=plan
read -r -d '' output << EOM
$(cat plan)
EOM
set_octopusvariable "plan-output" "$output"

In PS the code is slightly different, and I have tried many different ways of replacing the EOL characters

Set-OctopusVariable -Name "plan-output" -Value (terragrunt show plan -no-color)

Just so it is clear, this is PowerShell 7 running on Linux, so the EOL chars are LF, not CRLF

Below is an image of what the step output looks like after running it through PS. If run via bash script it shows up fine…

Hi tomer,

Thank you for reaching out to us with your query.

The manual intervention step uses markdown for formatting. It looks like you’ve wrapped the output variable in backticks to create a code block so it should be rendering the content ‘as-is’. That means the issue is likely to be with the content of the variable itself.

Could you please try capturing the output of the terragrunt command directly into a string variable before passing the variable into the Set-OctopusVariable cmdlet instead?

It could also be worth printing the same variable back to the console (to be viewed in the Task Log) so you can verify that it is being captured correctly.

Best Regards,

Charles

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.