Set progess in Inline Powershell task

Tips and tricks Inline Powershell task VSTS

Advertisements

Maximize how you use your VSTS build and release pipeline with Inline Powershell tasks. In this blog series ‘Tips and Tricks for Inline Powershell’, I will show simple samples on how to get more out of your pipelines. This blog post: Set progress.

VSTS Inline Powershell task
The Inline PowerShell VSTS task enables you to execute PowerShell from a textbox within your build or release pipeline. You can run a PowerShell script on you agent or as Azure Powershell.
Introduction Inline Powershell Task
Install Inline Powershell Task

Set progress
When your Inline Powershell task is running it is possible to show the progress in the build summary. This is useful when you have a long running task and want to see how it is going or even if there is any progress. Showing progress is done by writing a vso command to the output. The following is shown in the summary when the task is running:
progress

For ($i=0; $i -lt 100; $i++) {
    Write-Output "##vso[task.setprogress value=$i;]Log ouput"
    Start-Sleep -s 1
}

More tips and tricks
Use VSTS variables
Let your task fail
Set progress
Change buildnumber
VSTS Command overview
Call a WebHook
Download a file
Install a Powershell Module
Navigate VSTS as filesystem
Make VSTS API Rest calls
Script example: Act on failed build

Writing ‘##vso[task.setprogress value=42;]’ command to the output will show the progress when the build is running.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s