获取连续部署版本的拉取请求ID [Azure Pipelines] [英] Get the pull request ID of a continuous deployment release [Azure Pipelines]

查看:43
本文介绍了获取连续部署版本的拉取请求ID [Azure Pipelines]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置azure管道以触发每次PR更新的构建,以及每次合并的发布.由于PR合并时的几个原因,我需要访问PR的最新验证版本保存的数据.

I am trying to setup azure pipelines to trigger a build on every PR update, and a release on every merge. For a couple of reasons when the PR is merged, i need to access data saved by the latest validation build of the PR.

但是,在发布管道的运行过程中,我需要PRid.一个人怎么能做到这一点?

However to do that i need the PRid during the run of the Release pipeline. How can one achieve that?

推荐答案

根据您的情况,据我所知,在您的发行版中获取相关的构建信息很复杂.此外,如果未涵盖所有可能的情况,可能会导致意外结果.

Based on your scenario, to my knowledge, it is complex to get related build information in your release. Besides, it may cause unexpected result if not cover all possible scenarios.

我建议您可以参考以下步骤:

I'd suggest that you could refer to these steps blow:

  1. 删除发布的发布/构建工件或不必要的任务,仅保留待验证的任务,这将节省大量时间.(因为通常,验证构建将被触发太多次,浪费太多时间来发布无用的工件或其他数据)
  2. 创建新的构建管道并为目标分支(例如master)启用持续集成
  3. 添加发布构建/管道工件任务
  4. 编辑发布管道并链接此构建管道并启用持续部署.(可以添加其他过滤器)
  1. Remove publish build/pipeline artifact or unnecessary tasks, just remain tasks for validation, which will save a lot of time. (Because, in general, the validation build will be triggered too many times, waste too much time to publish useless artifact or other data)
  2. Create a new build pipeline and enable Continuous integration for target branch (e.g. master)
  3. Add publish build/pipeline artifact task
  4. Edit release pipeline and link this build pipeline and enable Continuous deployment. (Could add additional filters)

通过这种方式,在完成拉取请求之后,将触发此新的构建管道并发布必要的工件,然后将触发发行版.

With this way, after completing the pull request, this new build pipeline will be triggered and will publish necessary artifact, then the release will be triggered.

对于请求请求验证构建,他们只是执行验证代码的任务(例如,构建项目),而不发布工件.

For pull request validation builds, they just do tasks to validate the code (e.g. build project), but not publish artifact.

节省时间的简单方案:

拉取请求具有50个验证版本

A pull request has 50 validation builds

  • 老方法:每次发布工件需要1分钟,然后总时间为50分钟
  • 新方法:新管道负责构建和发布任务,它只运行一次,可能只需要10分钟.

然后您可以节省40分钟.

Then you can save 40 minutes.

这篇关于获取连续部署版本的拉取请求ID [Azure Pipelines]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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