【发布时间】:2021-01-03 03:34:21
【问题描述】:
我们有一组 Azure DevOps 管道模板,我们可以在多个存储库中重复使用这些模板。因此,我们希望有一个包含所有模板变量的文件。
repo 结构如下所示
template repo
├── template-1.yml
├── template-2.yml
└── variables.yml
project repo
├── ...
└── azure-pipelines.yml
variables.yml 看起来像这样
...
variables:
foo: bar
在template-1.yml 中,我们正在导入variables.yml,如here 中所述
variables:
- template: variables.yml
在azure-pipelines.yml 中我们使用这样的模板
resources:
repositories:
- repository: build-scripts
type: git
name: project-name/build-scripts
steps:
...
- template: template-1.yml@build-scripts
当我们现在尝试运行管道时,我们会收到以下错误消息:
template-1.yml@build-scripts (Line: 10, Col: 1): Unexpected value 'variables'
【问题讨论】:
标签: azure azure-devops yaml azure-pipelines