将现有(整个)Azure DevOps 管道迁移到基于 YAML 的管道(批量) [英] Migrating existing (entire) Azure DevOps pipeline to YAML based pipelines (in bulk)

查看:28
本文介绍了将现有(整个)Azure DevOps 管道迁移到基于 YAML 的管道(批量)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将现有的 Azure DevOps 管道移动到基于 YAML 的显着优势.问题是这些有很多,而且每个都有很多工作.

当我在 Azure DevOps 中四处点击时,查看 YAML"链接一次仅显示一项作业.因此,查看每个管道 x 作业的 YAML 并将其移动到代码中将需要大量手动工作.

但是对于每个管道,似乎都有一种方法可以在 json 中导出"整个管道.我想知道如果不是整个文件夹,是否有类似的方法至少将整个管道转储为 YAML.

如果有一个 API 可以导出相同的内容,那就更好了.

解决方案

到现在为止,我们所支持的就是你所看到的,使用View YAML来复制/粘贴代理作业的定义.获取一个管道的整个定义还有另一种解决方法是使用 API 从构建定义中获取 JSON将其转换为 YAML,调整语法,然后如果需要,更新引用的任务.

  • 首先,使用

    • 将 YAML 复制到 Azure Devops 的 YAML 编辑器.然后最重要的一步是调整语法.

    用任务名称版本替换refName键值.为此,您可以访问我们在 github 中打开的 tasks 源代码,内置任务可以在那里找到(注意:请查看对应任务的task.json文件)

    注意:使用此方法还有一个缺点,即您需要非常熟悉 YAML 语法,以便您可以调整从 JSON 成功转换的内容.

    I would like to move the existing Azure DevOps pipelines to YAML based for obvious advantages. The problem is there are many of these and each one has many jobs.

    When I click around in Azure DevOps, the "View YAML" link only appears for one job at a time. So that's gonna be a lot of manual work to view YAMLs for each pipeline x jobs and move that to code.

    But for each pipeline there seems to be a way to "export" the entire pipeline in json. I was wondering if there is a similar way to at least dump the entire pipeline as YAML if not an entire folder.

    If there is an API which exports the same then even better.

    解决方案

    Until now, what we supported is what you see, use View YAML to copy/paste the definition of agent job. There has another workaround to get the entire definition of one pipeline is use the API to get the JSON from a build definition, convert it to YAML, tweak the syntax, then if needed, update the tasks which are referenced.

    • Copy the YAML to a YAML editor of Azure Devops. Then the most important step is tweak the syntax.

    Replace the refName key values with task names and version. For this, you can go our tasks source code which opened in github, built in tasks can be found there(note: please see the task.json file of corresponding task)

    Noted: Use this method has another disadvantage that you need very familiar with YAML syntax so that you can tweak the content which convert from JSON successfully.

    这篇关于将现有(整个)Azure DevOps 管道迁移到基于 YAML 的管道(批量)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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