Azure 管道错误:找不到与模板文件模式匹配的任何文件 [英] Azure Pipeline Error: Could not find any file matching the template file pattern
问题描述
以代码形式在 Azure Pipeline 上工作,并尝试使用 YAML 管道通过 Azure 中的 ARM 模板创建资源.
Working on Azure Pipeline as code and trying to create a resource via ARM template in Azure using YAML pipeline.
在 Azure DevOps 中,我已将代码(部署 json、参数 json 和 yml 文件等)推送到功能分支下的 Azure Repos Git.
In Azure DevOps, I have pushed the code (deployment json, parameter json and yml file etc) into Azure Repos Git under a feature branch.
在运行管道时,由于csmFile"值,我面临错误错误:找不到与模板文件模式匹配的任何文件".
While running the pipeline, I am facing the error "Error: Could not find any file matching the template file pattern" due to "csmFile" value.
我的 yml 文件包含 ARM 模板部署信息,如下所示.
my yml file contains ARM template deployment info as below.
trigger:
branches:
include:
- dev-pipecode
pool:
vmImage: 'windows-latest'
steps:
- task: AzureResourceManagerTemplateDeployment@3
inputs:
deploymentScope: 'Resource Group'
azureResourceManagerConnection: 'company-development-Contributor'
subscriptionId: 'XXXXXXXX'
action: 'Create Or Update Resource Group'
resourceGroupName: 'name of the resource group'
location: 'North Europe'
templateLocation: 'Linked artifact'
csmFile: '$(System.DefaultWorkingDirectory)/AzureAuto/pipelineascode.json'
csmParametersFile: '$(System.DefaultWorkingDirectory)/AzureAuto/param-pipelineascode.json'
deploymentMode: 'Incremental'
我错过了什么吗?请指导我.谢谢.
Am I missing something? Please guide me. Thanks.
推荐答案
首先,仅供确认.
基于你在任务中定义的这个$(System.DefaultWorkingDirectory)/AzureAuto/pipelineascode.json
,你需要确定pipelineascode.json
在repos中的位置应该是这样的:
Based on this $(System.DefaultWorkingDirectory)/AzureAuto/pipelineascode.json
you defined in the task, you need make sure the location of pipelineascode.json
in repos should like this:
Repository
| AzureAuto
| | pipelineascode.json
| | param-pipelineascode.json
这是我的存储库示例:
如果您的 ARM 模板存储库的结构确实符合上述要求,那么现在我想它应该与您的分支相关.
If the structure of your ARM template repository indeed respect above mentioned, now I guess it should relevant with your branch.
您的 master 分支是否仍然包含 AzureAuto
文件夹和 pipelineascode.json
/param-pipelineascode.json
文件?
Does your master branch still contain AzureAuto
folder and the pipelineascode.json
/param-pipelineascode.json
files?
您可以到您遇到构建错误信息的build result
页面,确认分支名称是否是您存储ARM模板文件的分支名称:
You can go the build result
page you encountered the build error message, and confirm whether the branch name is the one you stored the ARM template files:
至于为什么我这么认为,这是因为系统将默认基于 master 分支构建,而用户从 new YAML 管道开始,首先 运行它.
As for why I guess so, it is because the system will build based on master branch by default while user start with the new YAML pipeline and first run it.
此时,您需要将azure-pipelines.yml
文件从master
分支复制到存储ARM模板文件的那个特性分支.
At this time, you need copy the azure-pipelines.yml
file from master
branch to that feature branch which stored ARM templates files.
然后去Pipelines
=> 打开对应的YAML build => Edit => 关注左上角并更改分支:
Then go Pipelines
=> Open corresponding YAML build => Edit => Focus on upper left corner and change the branch:
现在,此 YAML 管道应构建在您存储 ARM 模板的正确分支上,并成功找到 JSON 文件.
Now, this YAML pipeline should build on the correct branch you stored the ARM templates and succeed to find the JSON file.
这篇关于Azure 管道错误:找不到与模板文件模式匹配的任何文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!