【问题标题】:Create Azure DevOps release without artifacts via Rest API通过 Rest API 创建没有工件的 Azure DevOps 版本
【发布时间】:2020-04-23 13:38:29
【问题描述】:

我正在构建一个基于 documentation 的 JSON 正文。它看起来像这样(从文档中复制):

{
  "definitionId": 1,
  "description": "Creating Sample release",
  "artifacts": [
    {
      "alias": "Fabrikam.CI",
      "instanceReference": {
        "id": "2",
        "name": null
      }
    }
  ],
  "isDraft": false,
  "reason": "none",
  "manualEnvironments": null
}

但是,此版本没有任何工件。这只是需要运行的阶段。我尝试将“工件”值设置为 null 和 false。我还尝试完全删除“artifacts”键,如下所示:

{
  "definitionId": 1,
  "description": "Creating Sample release",
  "isDraft": false,
  "reason": "none",
  "manualEnvironments": null
}

不幸的是,所有这些猜测都只是抛出以下错误之一:

The artifact alias cannot be empty. Specify a valid artifact alias and try again.

Release pipeline name cannot be empty. Specify a name and try again.

如何使用 REST API 创建不包含工件的版本?

【问题讨论】:

  • 如果我的回答解决了您的问题,您可以 Accept it as an Answer ,这样可以帮助遇到相同问题的其他社区成员,我们可以存档此线程,谢谢。如果没有,请让我们知道您是否需要进一步的帮助。只是提醒this

标签: azure-devops azure-pipelines azure-devops-rest-api


【解决方案1】:

如何使用 REST API?

只需将其留空即可。使用这样的格式:

{
  "definitionId": 1,
  "description": "Creating Sample release",
  "artifacts": [],
  "isDraft": false,
  "reason": "none",
  "manualEnvironments": null
}

如果响应为 200 OK,则表示您运行其余 api 成功。 (这个api是用来创建release而不是创建release pipeline,你应该知道的!)

【讨论】:

    猜你喜欢
    • 2020-07-06
    • 2019-08-24
    • 1970-01-01
    • 2021-04-06
    • 2020-11-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多