我正在创建一个新的 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 文件进行更改时,管道永远不会触发,因此我知道我的语法是错误的。
最佳答案
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
关于azure - 当特定文件更改时触发管道,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68808475/