Azure DevOps分支并建立部署策略

发布于 2025-02-10 02:26:33 字数 184 浏览 1 评论 0原文

我正在研究Azure DevOps的Web服务项目。我已经写了YAML管道以进行构建和释放。

目前,我将YAML文件保存在开发分支中,并从同一分支创建管道作业。根据实践,我们有两个分支机构 - 主人&发展。那么,如何将单管路作业用于两个分支,并具有自动触发器的开发和计划基础的主分支呢?建立和部署代码到开发和主分支的最佳实践是什么?

I'm working on the web services project on the Azure DevOps. I have written the yaml pipeline for build and release.

Currently I have kept the yaml file in Develop branch and created the pipeline job from same. As per the practice, we have two branches - Master & Develop. So how I can use single pipeline job for both the branches with auto trigger for develop and schedules base for main branch ? What is the best practice to build and deploy the code to DEV, UAT and PROD environments for Development and Master branches?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

幽蝶幻影 2025-02-17 02:26:33

更新:

您需要确保在主中和开发中使用管道使用的YAML文件,否则提交不会触发管道。

中的纯Yaml触发设置。

,一个管道

trigger:
- none

schedules:
- cron: "53 7 * * *" 
  displayName: Master Schedule
  branches:
    include: 
      - master
  always: true 

pool:
  name: default

steps:
- script: echo Hello, world!
  displayName: 'Run a one-line script'

1

trigger:
- Develop

pool:
  name: default

steps:
- script: echo Hello, world!
  displayName: 'Run a one-line script'

一个管道中的纯UI设置。

”在此处输入图像描述“

原始答案:

您可以覆盖管道的CI触发器。

开发分支的管道:

“在此处输入图像描述”

”在此处输入图像描述“

主人分支的管道:

“在此处输入图像说明”

​/I.sstatic.net/l38ik.png“ rel =” nofollow noreferrer“>

Update:

You need to make sure the yaml file that the pipeline use exists in both master and Develop, otherwise the commit will not trigger the pipeline at all.

1, pure yaml trigger settings in one pipeline.

azure-pipeline.yml in Master branch:

trigger:
- none

schedules:
- cron: "53 7 * * *" 
  displayName: Master Schedule
  branches:
    include: 
      - master
  always: true 

pool:
  name: default

steps:
- script: echo Hello, world!
  displayName: 'Run a one-line script'

azure-pipeline.yml in Develop branch:

trigger:
- Develop

pool:
  name: default

steps:
- script: echo Hello, world!
  displayName: 'Run a one-line script'

2, pure UI settings in one pipeline.

enter image description here

enter image description here

Original Answer:

You can override the CI trigger of your pipeline.

Pipeline of develop branch:

enter image description here

enter image description here

Pipeline of master branch:

enter image description here

enter image description here

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文