azure 当特定文件更改时触发管道

zdwk9cvp  于 12个月前  发布在  其他
关注(0)|答案(1)|浏览(122)

我正在创建一个新的CI管道,它将在任何时候触发.bicep文件更改,然后压缩所有文件。

# Pipeline is triggered anytime there is a change to .bicep files
trigger:
  branches:
    include:
      - "feature/*"
pool:
  vmImage: ubuntu-latest

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

字符串
此管道工作,并在特性分支中进行更改时触发。
要针对任何.bicep文件,我正在尝试:

trigger:
  branches:
    include:
      - "feature/*"
  paths:
    include:
      - '**/*.bicep'


我还尝试指定保存文件的整个路由:

trigger:
  branches:
    include:
      - "feature/*"
  paths:
    include:
      - "src/Deployment/IaC/Bicep/*"


当我在特性分支中对.bicep文件进行更改时,管道永远不会被触发,因此我知道我的语法是错误的。

nr9pn0ug

nr9pn0ug1#

注意事项:当这个问题第一次被提出时,AZURE PIPELINES并没有对WILDCARD提供支持,但是Microsoft现在已经为PIPELINES重新引入了WILDCARD支持。请阅读下面的完整内容。

Azure管道不再支持通配符。只需像这样设置Bicep文件夹的相对路径:

paths:
include:
  - src/Deployment/IaC/Bicep

字符串
请参阅:https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/azure-repos-git?tabs=yaml&view=azure-devops#paths

**编辑:**看来又支持通配符了!

请参阅:https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/azure-repos-git?tabs=yaml&view=azure-devops#paths

相关问题