在VSTS持续部署中打开发布时的错误失败 [英] Open a bug on release fails in VSTS Continuous Deployment

查看:34
本文介绍了在VSTS持续部署中打开发布时的错误失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为具有PowerShell任务的Azure解决方案部署在VSTS上配置和计划了仅发行版本定义.但是,如果发布/部署失败,我想在VSTS中打开一个错误或工作项.

I have configured and scheduled only release definition on VSTS for Azure solution deployment which is having PowerShell tasks. But I want to open a bug or work item in VSTS if release/ deployment fails.

在VSTS中可以吗?

推荐答案

是的,如果发行失败,VSTS可能会创建错误.

Yes, it’s possible for VSTS to create a bug if a release failed.

添加另一个 PowerShell任务,以在先前任务失败时创建错误.PowerShell任务的详细设置如下:

Add another PowerShell task in the end of your release definition to create a bug if the previous task fails. Detail settings for the PowerShell task as below:

为Rume此任务选项选择仅当先前任务失败时,因此,如果先前任务失败,则将执行此PowerShell任务.

Select Only when a previous task has failed for Rume this task option, so if the previous task failed, this PowerShell task will be executed.

将powershell脚本添加到创建一个错误工作项,例如:

The add the powershell script to create a bug work item like:

$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

这篇关于在VSTS持续部署中打开发布时的错误失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆