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

david.grittmann's Avatar


13 Oct, 2017 08:11 PM

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.

  1. Support Staff 1 Posted by Shane Gill on 16 Oct, 2017 01:03 AM

    Shane Gill's Avatar

    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?


  2. 2 Posted by david.grittmann on 16 Oct, 2017 02:45 PM

    david.grittmann's Avatar
    [string]$ReportInfo = Format-ReportXml -Path C:\#DRG\dacpacdeploy\deploy.xml

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

    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">
        <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" />
        <Operation Name="Alter">
          <Item Value="[dbo].[tbtesttable1]" Type="SqlTable">
            <Issue Id="1" />
          <Item Value="[dbo].[tbtesttable1_logging]" Type="SqlTable">
            <Issue Id="2" />
          <Item Value="[dbo].[tbtesttable2]" Type="SqlTable">
            <Issue Id="3" />
          <Item Value="[dbo].[tbtesttable2_logging]" Type="SqlTable">
            <Issue Id="4" />
          <Item Value="[dbo].[tbtesttable2_staging]" Type="SqlTable">
            <Issue Id="5" />
  3. Support Staff 3 Posted by Shane Gill on 16 Oct, 2017 11:24 PM

    Shane Gill's Avatar

    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.


  4. 4 Posted by david.grittmann on 17 Oct, 2017 04:32 PM

    david.grittmann's Avatar

    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"
  5. Support Staff 5 Posted by Shane Gill on 18 Oct, 2017 11:56 PM

    Shane Gill's Avatar

    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.


  6. 6 Posted by jason.curley on 03 Nov, 2017 04:10 PM

    jason.curley's Avatar

    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

  7. david.grittmann closed this discussion on 03 Jan, 2018 07:42 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac