我正在尝试使用 azure-devops-rest-6.0 运行带有对象参数的管道
- name: images
displayName: docker images
type: object
default:
- image1
- image2
- image3
但是每次我在发布请求正文中传递此模板参数时,我都会得到 Expected aequence or mapping。实际值“image1””
"templateParameters": {
"images": "image1"
}
所以我尝试用数组类型替换它,但它会抛出错误,例如必须提供参数。
对于我确定我为所有字段提供了值的所有字段。
"templateParameters": {
"images": ["image1"]
}
我在传递值时错过了什么错误吗?正确的做法是什么?
最佳答案
根据您的 YAML 示例和请求正文,您需要修改请求正文中的格式。
您可以使用以下格式:
"templateParameters": {
"images": "[image1,image2]"
}
完整示例:
{
"resources": {
"repositories": {
"self": {
"refName": "refs/heads/main"
}
}
},
"templateParameters": {
"images": "[image1,image2]"
}
}
关于azure - 如何在azure devops api服务中传递具有多个值的对象参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72554007/