jobs.template definition
Şablonda tanımlanan bir iş kümesi.
jobs:
- template: string # Required as first property. Reference to a template for this deployment.
parameters: # Parameters used in a deployment template.
Bu tanıma başvuran tanımlar: jobs
Özellikler
template
Dize. İlk özellik olarak gereklidir.
Bu dağıtım için bir şablona başvuru.
parameters
şablon parametreleri.
Dağıtım şablonunda kullanılan parametreler.
Açıklamalar
Bir dosyada bir iş kümesi tanımlayabilir ve bunu diğer dosyalarda birden çok kez kullanabilirsiniz. İş şablonlarıyla çalışma hakkında daha fazla bilgi için şablonlara bakın.
Örnekler
Ana işlem hattında:
- template: string # name of template to include
parameters: { string: any } # provided parameters
Dahil edilen şablonda:
parameters: { string: any } # expected parameters
jobs: [ job ]
Bu örnekte, tek bir iş üç platformda yinelenir. İşin kendisi yalnızca bir kez belirtilir.
# File: jobs/build.yml
parameters:
name: ''
pool: ''
sign: false
jobs:
- job: ${{ parameters.name }}
pool: ${{ parameters.pool }}
steps:
- script: npm install
- script: npm test
- ${{ if eq(parameters.sign, 'true') }}:
- script: sign
# File: azure-pipelines.yml
jobs:
- template: jobs/build.yml # Template reference
parameters:
name: macOS
pool:
vmImage: macOS-latest
- template: jobs/build.yml # Template reference
parameters:
name: Linux
pool:
vmImage: ubuntu-latest
- template: jobs/build.yml # Template reference
parameters:
name: Windows
pool:
vmImage: windows-latest
sign: true # Extra step on Windows only
Ayrıca bkz.
İş şablonlarıyla çalışma hakkında daha fazla bilgi için şablonlara bakın.