通过REST API发布变量-Visual Studio Team Services [英] Release Variables through REST API - Visual Studio Team Services

本文介绍了通过REST API发布变量-Visual Studio Team Services的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将变量值传递给REST端点以进行VSTS中的发布管理?例如.呼叫PUT https://tfs.vsrm.visualstudio.com/defaultcollection/{project}/_apis/release/releases/30?api-version=3.0-preview.4并发出以下请求:

Is it possible to pass variable values to the REST endpoint for Release Management in VSTS? E.g. Calling PUT https://tfs.vsrm.visualstudio.com/defaultcollection/{project}/_apis/release/releases/30?api-version=3.0-preview.4 with the request of:

{
  "id": 30,
  "name": "Release-3",
  "variables": {
    "VariableName": {
      "value": "testing123"
    }
  }
}

如果我打电话给POST https://k2tfs.vsrm.visualstudio.com/density/_apis/release/releases/?api-version=3.0-preview.4,我设法设法使其工作,然后接受该响应并在上面的请求中使用它.这是唯一的方法吗?

I somehow managed to get it to work if I call POST https://k2tfs.vsrm.visualstudio.com/density/_apis/release/releases/?api-version=3.0-preview.4 then take that response and use it in the request above. Is this the only way?

推荐答案

创建新版本时,无法更改变量值.

There isn’t the way to change variable value when create a new release.

关于您的方式,它会修改创建的发布变量值,更改的值可以在部署发布时使用.

Regarding your way, it modifies the created release variable value, the changed value can be used when deploy the release.

另一种方法是,您可以创建草稿版本

Another way is that, you can create a draft release,

帖子:

https://[account].vsrm.visualstudio.com/[project]/_apis/release/releases/?api-version=3.0-preview.4

application/json:

application/json:

{
  "definitionId": [release definition id],
  "isDraft":true
}

然后更新变量的值(如您所说)

then update variables’ value (as you said)

之后,您可以通过

after that, you can start the release by Modifying the status of a release (active)

{
    "status": "Active"
}

这篇关于通过REST API发布变量-Visual Studio Team Services的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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