共用方式為


擴充定義

使用範本擴充管線。

extends:
  template: string # The template referenced by the pipeline to extend.
  parameters: # Parameters used in the extend.

參考此定義的定義:管線

性能

template 字串。
管線所參考的範本進行擴充。

parameters 範本參數。
擴充中使用的參數。

範例

範本及其參數會在管線執行之前轉換成常數。 範本參數提供輸入參數的類型安全性。 在此範例中,範本會藉由提供可能選項的列舉,而不是手繪多邊形字串,來限制管線中可以使用的集區。

# template.yml
parameters:
- name: userpool
  type: string
  default: Azure Pipelines
  values:
  - Azure Pipelines
  - private-pool-1
  - private-pool-2

pool: ${{ parameters.userpool }}
steps:
- script: # ... removed for clarity
# azure-pipelines.yml
extends:
  template: template.yml
  parameters:
    userpool: private-pool-1

另請參閱