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,450 points
744 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,890 points

Related Questions In DevOps on Cloud

0 votes
1 answer

I am looking for a python code to get my Azure VM status in my email , like whether the running vms port is open to the internet. If its open to internet I should get a mail notification

Hey, @Sourav, Check this out https://www.edureka.co/community/66025/azure-vm-monitoring It deals with ...READ MORE

answered May 29, 2020 in DevOps on Cloud by Sirajul
• 59,230 points
1,804 views
0 votes
2 answers
0 votes
1 answer
0 votes
1 answer

How to use specific node version for yarn setup in AWS deployment?

You should be able to set your ...READ MORE

answered Jul 20, 2018 in DevOps on Cloud by Kalgi
• 52,350 points
1,013 views
+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
3,925 views
+15 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,035 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,220 points
4,882 views
+2 votes
2 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP