Azure Devops - 在拉取请求上触发管道,但不在推送上触发管道?
我有一个 ADO git 存储库,其中包含基于 YAML 的构建管道,该管道构建 docker 映像,使用 Docker Compose 运行一些测试,然后将映像和 helm 图表推送到 ACR。
我希望构建/测试部分也能在 PR 上运行。我创建了第二个管道,它只是正常构建的前半部分,并将其分配为分支的构建验证管道。
但是,我似乎无法正确触发。如果我在测试管道中有trigger: none
,它永远不会触发。如果我有分支名称,它也会与正常的构建管道一起在合并时运行。这应该如何运作?该文档定义了所有各个部分,但并没有真正定义它们如何交互!
我是否应该有一个多级管道并以某种方式使用它进行验证? (目前只是一个阶段中一项工作的 4 个步骤)。
我希望避免多次构建相同的图像,或在构建代理之外的任何地方存储未经测试的图像。
I have a ADO git repo with a YAML-based build pipeline that builds a docker image, runs some tests using Docker Compose, and then pushes the image and a helm chart to an ACR.
I'd like the have the build/test part run on PRs too. I have created a second pipeline that's just the first half of the normal build, and assigned it as a Build Validation pipeline for a branch.
However, I don't seem to be able to get the triggers right. If I have trigger: none
in the test pipeline, it never triggers. If I have branch names, it is also run on merge alongside the normal build pipeline. How is this supposed to work? The docs define all the individual parts, but not really how they are expected to interact!
Am I supposed to have a multistage pipeline and use that somehow for the validation? (it's just 4 Steps in one Job in one Stage currently).
I am hoping to avoid building the same image too many times, or storing untested images anywhere outside the build agent.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用以下配置使其工作:
在我的 YAML 管道中,我设置了
trigger: none
。在分支的分支策略中,我创建了一个带有自动触发器的构建验证:

然后我创建一个到该分支的拉取请求,管道会自动运行:

有两个可能的错误:
I make it work with the following configuration:
In my YAML pipeline, I set the
trigger: none
.In branch policies of a branch, I create a build validation with automatic trigger:

Then I create a pull request to that branch, and the pipeline runs automatically:

There are two possible mistakes: