我正在尝试创建一个基于YAML的管道,它需要一个参数,然后通过Azure DevOps REST API触发管道运行。我能够看到构建已排队,但参数没有从我的POST正文中被覆盖。
我的模板my-template.yaml
。
parameters:
- name: testParam
type: string
default: 'N/A'
steps:
- script: echo ${{ parameters.testParam }}
扩展模板的我的管道 YAML。
trigger:
- master
extends:
template: my-template.yaml
然后我使用queue build
REST API触发了这个流水线:https://dev.azure.com/{organization}/{project}/_apis/build/builds?api-version=5.1
,POST 请求的请求体如下。
{
"parameters": "{\"testParam\": \"hello world\"}",
"definition": {
"id": 50642
},
"sourceBranch": "refs/heads/master"
}
所以我期望管道执行会打印出hello world
而不是N/A
。不幸的是,我仍然在管道结果中看到N/A
。
有人知道发生了什么吗?我错过了什么吗?