是否可以在Azure Pipelines任务的YAML中使用 multiline ?例如,对于ARM部署任务,有一个 overrideParameters 属性。如果可以跨多行拆分而不是将所有内容放在一行中,那就太好了
- task: AzureResourceManagerTemplateDeployment@3
displayName: 'ARM deploy MyFunctionAPP'
inputs:
deploymentScope: 'Resource Group'
azureResourceManagerConnection: ${{ parameters.serviceConnection }}
subscriptionId: ${{ parameters.subscriptionId }}
action: 'Create Or Update Resource Group'
resourceGroupName: ${{ parameters.resourceGroupName }}
location: 'West Europe'
templateLocation: 'Linked artifact'
csmFile: '$(ARMtemplatesPath)\MyFunctionAPP\template.json'
csmParametersFile: '$(ARMtemplatesPath)\MyFunctionAPP\parameters.json'
deploymentMode: 'Incremental'
overrideParameters: '-environment_name ${{ parameters.environmentName }} -vnetAddressPrefix ${{ parameters.vnetAddressPrefix }} -subnet1Prefix ${{ parameters.subnet1Prefix }} -APIkey ${{ parameters.APIkey }} -queueName ${{ parameters.queueNameMyQueue }} -SendGridAPIkey ${{ parameters.SendGridAPIkey }} -StorageConnectionAppSetting ${{ parameters.StorageConnectionAppSetting }}'
是否可以在多行上拆分overrideParameters值?
答案 0 :(得分:1)
这对我有用:
document.getElementById()
因此,在一行上使用overrideParameters: >-
-environment_name "${{ parameters.environmentName }}"
-vnetAddressPrefix "${{ parameters.vnetAddressPrefix }}"
-subnet1Prefix "${{ parameters.subnet1Prefix }}"
-APIkey "${{ parameters.APIkey }}"
-queueName "${{ parameters.queueNameMyQueue }}"
-SendGridAPIkey "${{ parameters.SendGridAPIkey }}"
-StorageConnectionAppSetting "${{ parameters.StorageConnectionAppSetting }}"
,然后使用双引号将设置值引起来。
答案 1 :(得分:0)
是否可以通过某种方式拆分overrideParameters值 多行?
根据文档Expressions,对于多行字符串,我们可以使用竖线字符(|
)
- task: AzureResourceManagerTemplateDeployment@3
displayName: 'ARM deploy MyFunctionAPP'
inputs:
deploymentScope: 'Resource Group'
azureResourceManagerConnection: ${{ parameters.serviceConnection }}
subscriptionId: ${{ parameters.subscriptionId }}
action: 'Create Or Update Resource Group'
resourceGroupName: ${{ parameters.resourceGroupName }}
location: 'West Europe'
templateLocation: 'Linked artifact'
csmFile: '$(ARMtemplatesPath)\MyFunctionAPP\template.json'
csmParametersFile: '$(ARMtemplatesPath)\MyFunctionAPP\parameters.json'
deploymentMode: 'Incremental'
overrideParameters: |
-environment_name ${{ parameters.environmentName }}
-vnetAddressPrefix ${{ parameters.vnetAddressPrefix }}
-subnet1Prefix ${{ parameters.subnet1Prefix }}
-APIkey ${{ parameters.APIkey }}
-queueName ${{ parameters.queueNameMyQueue }}
-SendGridAPIkey ${{ parameters.SendGridAPIkey }}
-StorageConnectionAppSetting ${{ parameters.StorageConnectionAppSetting }}
您可以查看this thread了解更多详细信息。