gpt4 book ai didi

azure - 如何使用yaml文件在azure管道中参数化代理池名称

转载 作者:行者123 更新时间:2023-12-02 23:11:36 25 4
gpt4 key购买 nike

您好,我在 azure 管道中使用代理池,所以我有多个代理,所以我想参数化池名称,如下所示,但当我这样做时,我收到错误(行:11,列:9):A此上下文中不允许使用模板表达式

parameters:
- name: pool_name
displayName: agent pool location
type: string
default: test-ashish

trigger:
- none

pool:
name: ${{parameters.pool_name}}
demands:
- Location -equals EASTUS2

steps:
- script: |
echo "This job is only for testing"
echo $()
name: Test_Job
displayName: Test Job

最佳答案

可以使用本期的答案解决这个问题:Azure Devops: Is it possible to nest yaml templates inside another yaml template? .

从链接复制:引用代码:

parameters:
buildArtifactName: "build"
solution: ""

jobs:
- job: 'BuildSolution'
pool:
vmImage: ${{parameters.vmImage}}
continueOnError: false
variables:
artifactName: ${{ parameters.buildArtifactName}}
steps:
- task: NuGetCommand@2
displayName: 'Restore NuGet packages'
inputs:
restoreSolution: ${{ parameters.solutionDir }}/${{ parameters.solution }}
configuration: ${{parameters.buildConfiguration}}

关于azure - 如何使用yaml文件在azure管道中参数化代理池名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66949346/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com