知识检查
请考虑以下管道定义和管道模板:
azure-pipelines.yml:
trigger: none
pool:
vmImage: ubuntu-latest
stages:
- template: deploy.yml
parameters:
environmentName: Sandbox
- template: deploy.yml
parameters:
environmentName: Production
deploy.yml:
parameters:
- name: environmentName
type: string
stages:
- stage: Deploy
jobs:
- job: Deploy
steps:
- checkout: self
- task: AzureCLI@2
name: DeployBicepFile
displayName: Deploy Bicep file
inputs:
azureSubscription: SharedServiceConnection
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az deployment group create \
--name $(Build.BuildNumber) \
--resource-group ${{parameters.environmentName}}_rg \
--template-file deploy/main.bicep \
--parameters deploy/parameters.${{parameters.environmentName}}.json
Git 存储库的 deploy 文件夹还包含 Bicep 文件和参数文件。