Generating Simple Octopus Release notes from VSO REST

One of the common issue’s I’ve had is when using octopus marking in the release notes “whats new” in this version.

Weather pushing from TeamCity or team build the issue is the same.

So here’s some powershell i use in a “PowerShell” build step in TeamCity to generate basic “Work item” plus “Change Set” lists with links through to Visual Studio Online.

You will need to add some variables into you parameters and pass them through into the script. For the from and to change set IDs you can use these two from TeamCity

%build.vcs.number% %build.vcs.number.1%

To setup Basic Auth Creds check here


Write-Host "Starting Writing Release Notes"
$basicAuth = ("{0}:{1}" -f $username,$password)
$basicAuth = [System.Text.Encoding]::UTF8.GetBytes($basicAuth)
$basicAuth = [System.Convert]::ToBase64String($basicAuth)
$headers = @{Authorization=("Basic {0}" -f $basicAuth)}
$cs = Invoke-RestMethod -Uri "https://$$fromID&toId=$toID&api-version=1.0" -headers $headers -Method Get

$wiIDs = @()


foreach($c in $cs.value)
$urlvar = $c.url
$s = Invoke-RestMethod -Uri $urlvar"?includeWorkItems=true&api-version=1.0" -headers $headers -Method Get

$releaseNotesCS += "<a href='https://$" + $s.changesetId + "'>" + $s.changesetId + "</a> " + $s.comment +"`r`n
Write-Host $s
foreach ($wi in $s.workItems)
Write-Host "In Array Already";
$releaseNotesWI += "<a href='" + $wi.webUrl + "'>" + $ + "</a> " +$wi.title + " (" + $wi.state + ")`r`n
Write-Host $wi;

"+$releaseNotesCS | out-file ".\ReleaseNotes.html"
Write-Host "Finished Writing Release Notes"

Then in your octopus step simply set “Additional command line arguments”


Leave a Reply

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

You are commenting using your 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