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

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

问题描述

我想将现有的Azure DevOps管道移至基于YAML的明显优势.问题是其中有很多,每个人都有很多工作.

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

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

如果有一个API可以导出相同的API,那么甚至更好.

解决方案

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

  • 首先,使用

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

    refName键值替换为任务名称版本.为此,您可以转到在github中打开的任务源代码,内置任务可以在此处找到(注意:请参见相应任务的 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天全站免登陆