【问题标题】:How to get YAML code of a build pipeline?如何获取构建管道的 YAML 代码?
【发布时间】:2019-12-12 21:57:16
【问题描述】:

我需要获取构建管道的 YAML 脚本。但是当我选择管道时,“查看 YAML”链接不可见。 (当我选择管道下的代理/任务时可见。)

是否有任何其他方式来获取 YAML 脚本或任何方式来启用构建管道的“查看 YAML”链接?

【问题讨论】:

  • AFAIK 目前无法将整个管道视为 yaml,因此您需要手动组合每个任务的 yaml。

标签: azure azure-devops continuous-integration azure-pipelines continuous-deployment


【解决方案1】:

来自this GitHub 问题,似乎 YAML 构建导出曾经是可能的,但现在不再可行,我也可以看到它。你可以要求回here

作为权宜之计,我认为仍然可以使用命令行来获取 yaml 格式的构建定义。 ;)

这可以通过在 Azure CLI 中使用 azure-devops 扩展来实现。您所要做的就是:

# Add the Azure DevOps extension
az extension add --name azure-devops

# Confirm the installation
az extension list -o table

# Sign in to your account
az login

# (Optional) Configure defaults:
az devops configure --defaults organization=https://dev.azure.com/contoso project=ContosoWebApp

# List your build definitions
az pipelines build definition list -o table

# Get your build definition by ID in yaml format and save it in a file
az pipelines build definition show --id <id> -o yaml > builddef.yaml

这将提供一个简洁的 yaml,满足您的所有需求。希望这会有所帮助!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-06-08
    • 2020-01-07
    • 1970-01-01
    • 2020-08-29
    • 2020-12-21
    • 2019-05-14
    • 2019-09-07
    • 2019-06-01
    相关资源
    最近更新 更多