Octopus Step Template - LogOctopusParameters

octopus-LogOctopusParameters

Creates and writes a powershell script to the Release Task Log during deployment. This powershell script can be copy/pasted to a powershell console, and it will generate an $OctopusParameters variable with all of the values used during the deployment, along with helper methods .ToGridView(), .ToScreen(), and .ToClipBoard() which should be self explanatory. This should help with debugging deployments.

This is what the log output looks like for this step:

Tentacle Script Execution

 #Copy this log section to a Powershell Editor or terminal. and run it.
 #It will create an $OctopusDeploy Dictionary Variable.
 
function info { param([string] $time) process {}}
$OctopusParameters = @{}
$OctopusParameters.Add("Parameter_1", "Foo")
$OctopusParameters.Add("Parameter_2", "Bar")
#... one line for every OctopusParameter entry
$OctopusParameters | add-member -memberType ScriptMethod -Name ToClipboard -value {$this.GetEnumerator() |sort -Property Name | format-table -AutoSize | out-string -width 512 | set-clipboard; };
$OctopusParameters | add-member -memberType ScriptMethod -Name ToGridView  -value {$this.GetEnumerator() |sort -Property Name | out-gridview; };
$OctopusParameters | add-member -memberType ScriptMethod -Name ToScreen    -value {$this.GetEnumerator() |sort -Property Name | format-table -AutoSize | out-string -width 512; };
CLS
 
write-host "To display a gridview of the Octopus Parameters, run this command: `$OctopusParameters.ToGridView()"
write-host "To list the Octopus Parameters, run this command: `$OctopusParameters.ToScreen()"
write-host "To copy the Octopus Parameters to the clipboard, run this command: `$OctopusParameters.ToClipboard()"
Info    14:30:17
==============================================
PowerShell exit code: 0
==============================================

Hi @bjones1,

Thank you for taking the time to create and post this script!

We really appreciate it when community members offer support, feedback, and creative solutions.

It looks like there is a dialog with our dev team for this script. I’ll leave it in their capable hands.

If you need anything or have any questions for the Support Team, feel free to ask. We’re happy to help. :slightly_smiling_face:

Regards,
Donny

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