Can I show a progress bar during a deployment?

I have a long-running task that performs several actions. I’d like to show a progress bar with a percentage while the deployment is running. Can you do this in Octopus?

You can use the Update-Progress command in PowerShell (or one of its alternatives). It takes a percentage and an optional message as parameters.

$updates = @(@{ percent=0; message="Getting started..." }, @{ percent=10; message="Waking the kraken..." }, @{ percent=20; message="Hoarding treasure..." }, @{ percent=30; message="Sinking battleship..." }, @{ percent=40; message="Refilling ink..." }, @{ percent=50; message="Blending in..." }, @{ percent=60; message="Taking nap..." }, @{ percent=70; message="Recording Ask Octopus..." }, @{ percent=80; message="Auditioning for next Spider-Man movie..." }, @{ percent=90; message="Did I leave the stove on...?" }, @{ percent=100; message="Finishing up..." })

$updates | ForEach-Object {
  Update-Progress $_.percent $_.message
  Start-Sleep (Get-Random -Minimum 2 -Maximum 5)

The progress bar will display on the Task Log while the step is running.

@ryanrousseau This is awesome and perfect timing for a Step Template I’m developing! Out of curiosity, Is there an equivalent Python command for this as well?

Yep! You can use the updateprogress function.

I’ll be updating the docs soon to include info on this and all the ways to call it.

1 Like