【问题标题】:Unexpected value 'resources'" in YAML templateYAML 模板中的意外值“资源””
【发布时间】:2020-08-29 16:29:56
【问题描述】:

有没有办法在 Yaml 模板中声明资源?

#yaml template
parameters:
- name: p1
resources: 
   repositories: #repository with cd template
     - repository: yaml.templates

【问题讨论】:

  • 非常感谢这里分享的这个解决方案!您可以接受您的回答,以便其他人可以直接知道这是工作。

标签: azure azure-devops yaml


【解决方案1】:

目前无法在模板中声明资源。 只有“根”yaml 文件可以声明资源。 当前的解决方法是将模板中的所有引用资源提升到“根”yaml 文件中。

https://developercommunity.visualstudio.com/content/problem/728151/unexpected-value-resources-in-yaml-template.html

【讨论】:

    【解决方案2】:

    本期关注beatcracker:https://github.com/Microsoft/azure-pipelines-yaml/issues/49

    如果您使用 extends 关键字,应该可以包含来自模板的资源。我无法确认它,因为 extends 关键字目前仅在 Azure DevOps Services 中受支持。

    但他给出了下面的例子。

    azure-pipelines.yml

    resources:
      containers:
      - container: node_latest
        image: node:latest
    
    extends:
      template: template.yml
    

    模板.yml

    resources:
      containers:
      - container: node_lts
        image: node:lts
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-02
      • 2019-11-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多