Is it possible to open a bug in VSTS if release deployment fails?

0 votes

I am using VSTS for azure solution deployment having powershell tasks. The release definitions on VSTS are all configured and scheduled. Now, I want to know if its possible to open a bug in VSTS if the release deployment fails.

Apr 24, 2018 in DevOps on Cloud by DragonLord999
• 8,380 points
57 views

1 answer to this question.

0 votes

You can do this by adding another PowerShell task(to create a bug) at the end of your release definition if the task before fails. Select the option "Only when a previous task has failed".

enter image description here

Your PowerShell script to create a bug should look something like this:

$witType="Bug"
$witTitle="title"
$u="https://account.visualstudio.com/DefaultCollection/project/_apis/wit/workitems/`$$($witType)?api-version=1.0"
$body="[
  {
    `"op`": `"add`",
    `"path`": `"/fields/System.Title`",
    `"value`": `"$($witTitle)`"
  }
]"
$user = "username"
$token = "PAT"

$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user,$token)))
$result=Invoke-RestMethod -Method PATCH -Uri $u -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -ContentType "application/json-patch+json" -Body $body
answered Apr 24, 2018 by DareDev
• 6,810 points

Related Questions In DevOps on Cloud

0 votes
2 answers
0 votes
1 answer
0 votes
1 answer
+3 votes
2 answers
+5 votes
7 answers

Docker swarm vs kubernetes

Swarm is easy handling while kn8 is ...READ MORE

answered Aug 27, 2018 in Docker by Mahesh Ajmeria
982 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
124 views
+4 votes
2 answers

unable to get subdomain of URL in NGINX

You just need to add .+ after ...READ MORE

answered Oct 11, 2018 in DevOps on Cloud by lina
• 8,100 points
566 views
+2 votes
2 answers