Displaying a multi-line string or powershell array from an xml file in the manual intervention step

We are trying to make it easy for a reviewer to approve/deny a paused deployment that is waiting for intervention. Is there a way to pass a multi-line variable or array from the previous step in the approval description? I can only get the first line of the XML doc to display in the manual intervention prompt.

Previous step sets the variable from an XML document.
[string]$ReportInfo = Format-ReportXml -Path $DeployOutputPath

Set-OctopusVariable "OctopusReportInfo" -Value "$ReportInfo"

The ‘instructions’ field of the wait for confirmation step contains:

#{Octopus.Action[DacPac Report].Output.OctopusReportInfo}

Only the first line is shown in the approval step. Screenshot of that is attached.

Hi David,

Thanks for getting in touch.

I can get a simple multi-line approval working doing the following, but it displays all on one line (doesn’t insert
):

$ReportInfo = @'
line 1
line 2
'@

Set-OctopusVariable "OctopusReportInfo" -Value "$ReportInfo"

Would it be possible to get your $ReportInfo, or maybe just a sample?

Thanks,
Shane

[string]$ReportInfo = Format-ReportXml -Path C:\#DRG\dacpacdeploy\deploy.xml
$ReportInfo 

Format-ReportXml is a function available here: https://www.powershellgallery.com/packages/format-xml/1.2/Content/format-xml.ps1

This is the value of $ReportInfo after some test changes that I just pushed through:

<?xml version="1.0" encoding="utf-8"?>
<DeploymentReport xmlns="http://schemas.microsoft.com/sqlserver/dac/DeployReport/2012/02">
  <Alerts>
    <Alert Name="DataIssue">
      <Issue Value="The column [dbo].[tbtesttable1].[TestColumn45] is being dropped, data loss could occur." Id="1" />
      <Issue Value="The column [dbo].[tbtesttable1_logging].[Test45Column] is being dropped, data loss could occur." Id="2" />
      <Issue Value="The column [dbo].[tbtesttable2].[Test45Column] is being dropped, data loss could occur." Id="3" />
      <Issue Value="The column [dbo].[tbtesttable2_logging].[Test45Column] is being dropped, data loss could occur." Id="4" />
      <Issue Value="The column [dbo].[tbtesttable2_staging].[Test45Column] is being dropped, data loss could occur." Id="5" />
    </Alert>
  </Alerts>
  <Operations>
    <Operation Name="Alter">
      <Item Value="[dbo].[tbtesttable1]" Type="SqlTable">
        <Issue Id="1" />
      </Item>
      <Item Value="[dbo].[tbtesttable1_logging]" Type="SqlTable">
        <Issue Id="2" />
      </Item>
      <Item Value="[dbo].[tbtesttable2]" Type="SqlTable">
        <Issue Id="3" />
      </Item>
      <Item Value="[dbo].[tbtesttable2_logging]" Type="SqlTable">
        <Issue Id="4" />
      </Item>
      <Item Value="[dbo].[tbtesttable2_staging]" Type="SqlTable">
        <Issue Id="5" />
      </Item>
    	</Operation>
    </Operations>
</DeploymentReport>

Hi David,

Thanks for sending details.

It looks like the issue is rending XML in the manual intervention step. I’ve created an issue you can track and contribute to: https://github.com/OctopusDeploy/Issues/issues/3862

The instruction for the manual intervention step are being set correctly. As a workaround you might consider converting your XML to JSON for the instructions.

Cheers,
Shane

Thanks for the workaround Shane. Displaying in JSON doesn’t look too bad if I select only the alert section.

I still need demo this for the group, but I think this’ll will be fine for now.

[xml]$xmlReportInfo = Get-Content $DeployOutputPath
$json = $xmlReportInfo.DeploymentReport.Alerts.alert.issue
$ReportInfo = $json.value | ConvertTo-Json

Set-OctopusVariable "OctopusReportInfo" -Value "$ReportInfo"

Hi David,

It turns out the reason your XML isn’t being displayed is because the instructions are in markdown format. For the fix I think we are just going to make it clearer that the instructions are markdown, I only just realised as well.

Cheers,
Shane

David, unrelated to this thread, i used code from you from another post and had some questions about it, if you could, please let me know if you have any answers, thanks: https://help.octopusdeploy.com/discussions/questions/14590-deploy-a-certificate-to-azure-app-service