Azure Pipelines Stages (YAML) 上的手动触发器 [英] Manual Trigger on Azure Pipelines Stages (YAML)

查看:18
本文介绍了Azure Pipelines Stages (YAML) 上的手动触发器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Azure Pipelines YAML 格式设置管道.我创建了 3 个阶段:构建、暂存和生产.顾名思义,构建阶段构建项目并发布构建工件.Staging 阶段部署到 Staging 环境,Production 阶段部署到 Production 环境.

在我的项目的环境部分,我添加了对生产环境的检查,以便我可以在上线前批准部署.

我的管道的工作方式是在构建阶段完成后自动触发暂存阶段和生产阶段.我不喜欢这一点的是,当开发人员将他们的代码部署到 Staging 时,他们需要几天的时间在 Staging 上测试它,然后再将他们的代码推送到生产环境.所以,在那之前,我的管道一直在运行并等待我的批准.左上角的微调器不断旋转,持续时间"字段不断传递.

有什么方法可以让开发人员在准备就绪时手动触发生产阶段而不是构建阶段触发它?

解决方案

yaml 管道中的手动阶段当前不可用.这个

实现此目的的另一种方法是将您的 yaml 管道分成两个 yaml 管道(阶段管道和生产管道).并禁用生产管道的 CI 构建(在管道编辑页面中,单击右上角的 3 个点并选择触发器.请参考下图).

这样您就可以在开发人员完成测试后手动运行生产管道.

I'm setting up a pipeline using Azure Pipelines YAML format. I have created 3 stages: Build, Staging, and Production. As the names suggest, the Build stage builds the project and publishes the build artifacts. The Staging stage deploys to the Staging environment and the Production stage deploys to the Production environment.

In the Environments section of my project, I have added a check for the Production environment so that I can approve the deployment before going live.

The way that my pipeline works is that both Staging and Production stages are triggered automatically after the Build stage is finished. What I don't like about this is that when developers deploy their code to Staging, they need a couple of days to test it on Staging before pushing their code to Production. So, until then, my pipeline keeps running and waiting for my approval. The spinner at the top-left corner keeps spinning and the "Duration" field keeps passing.

Is there any ways that develpers manually trigger the Production stage whenever they are ready instead of the Build stage triggering it?

解决方案

Manual stages in yaml pipeline is not available currently. This feature request has been submitted to Microsoft. You can go and vote it up or submit a new one.

There are workarounds to achieve this.

You can move your staging and production stages to Classic Web UI Release Pipeline. Manually trigger a stage is available in Web UI Release pipeline. Please check here for more information.

Another way to achieve this is to separate your yaml pipeline into two yaml pipelines(stage pipeline and production pipeline). And disable CI build for production pipeline( in the pipeline edit page, click on the 3dots on the top right corner and choose triggers. Please refer to below pics).

So that you can manually run production pipeline after Developer done with their tests.

这篇关于Azure Pipelines Stages (YAML) 上的手动触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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