简体   繁体   English

有没有办法使用 Azure Devops 将 yaml 构建管道转换为发布管道?

[英]Is there a way to translate a yaml build pipeline to a release pipeline using Azure Devops?

In my build pipeline I am running Pester tests and reporting to the output folder.在我的构建管道中,我正在运行 Pester 测试并向 output 文件夹报告。 During release I want to run these and only go to the next stage (deploy) if all tests pass.在发布期间,如果所有测试都通过,我想运行这些并且只有 go 到下一阶段(部署)。 I am not concerned about the results, I just want to make sure that they all pass.我不关心结果,我只想确保它们都通过。 I have tried to 'copy' my existing yaml file using the GUI however not sure of the best way to do this and variable scope.我曾尝试使用 GUI“复制”我现有的 yaml 文件,但不确定执行此操作的最佳方法和变量 scope。 Is it possible to translate a build pipeline directly to an Azure release pipeline in Azure Devops and if so, what is the best approach for doing this?是否可以将构建管道直接转换为 Azure Devops 中的 Azure 发布管道,如果可以,最好的方法是什么?

I tried to translate it to json however i had an undefined error when I tried to import the json pipeline.我尝试将其转换为 json 但是当我尝试导入 json 管道时出现undefined的错误。 I should also add that I can't see a solution by looking at the preview features for this.我还应该补充一点,通过查看此预览功能我看不到解决方案。

I am afraid it is not possible to translate a build pipeline directly to an Azure release pipeline.恐怕不可能将构建管道直接转换为 Azure 发布管道。

You need to manually add the same tasks which are in the build pipeline to the release stage.您需要手动将构建管道中的相同任务添加到发布阶段。 I believe it is not a complex work to create a stage with the same tasks in the release pipeline.我相信在发布管道中创建一个具有相同任务的阶段并不是一项复杂的工作。 You just need to add each tasks with the same configurations(copy and paste mostly).您只需要添加具有相同配置的每个任务(主要是复制和粘贴)。 And create the same variables in Variables tab.并在Variables选项卡中创建相同的变量。 Check document about classic CD release pipeline .查看有关经典 CD 发布管道的文档。

There is another workaround using multiple stages yaml pipeline instead of classic release pipepline.还有另一种使用多阶段 yaml 管道而不是经典发布管道的解决方法。

With multiple stage yaml pipeline.具有多级 yaml 流水线。 You can just easily move your build yaml content in a stage.您可以轻松地将您的构建 yaml 内容移动到一个阶段。 Check here for more information. 在这里查看更多信息。 See below:见下文:

trigger: none

stages:
- stage: Test
  jobs: 
  - job: Pester tests
    pool:
      vmImage: windows-latest
    steps:
    ..

- stage: Deploy
  jobs: 
  - job: DeployJob
    pool:
      vmImage: windows-latest
    steps:
    ..

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure Devops - YAML 发布管道 - 如何使用下拉列表 select 构建管道中的特定工件 - Azure Devops - YAML Release Pipelines - How to select a specific artefact from a build pipeline using a dropdown list 是否可以将 Azure DevOps YAML 管道集成到发布管道中? - Is it possible to integrate an Azure DevOps YAML pipeline into a release pipeline? 请参阅使用 YAML 管道在 Azure DevOps 中构建工件 - See Build Artifacts in Azure DevOps with YAML Pipeline Azure devops使用Yaml文件无法构建管道 - Azure devops build pipeline with yaml file not working 如何使用 Azure DevOps REST API 运行构建/发布管道 - How to run build/release pipeline using Azure DevOps REST API Azure DevOps 发布管道 - Azure Devops Release Pipeline Azure DevOps 中的构建管道和发布管道有什么区别? - Whats the difference between a build pipeline and a release pipeline in Azure DevOps? Azure 使用 terraform 创建 devops 发布管道 - Azure devops release pipeline creation using terraform 在 Azure Devops 发布管道中更改 yaml 文件的分支 - Changing the branch of the yaml file in an Azure Devops Release Pipeline 使用 Azure DevOps,如何将发布管道迁移到代码,类似于构建管道 yml? - Using Azure DevOps, how do I migrate a release pipeline to code, similar to build pipeline yml?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM