azure-devops - 在 VSTS API 中排队 yaml 构建导致无法解决参考错误
问题描述
我正在使用 PowerShell 在 VSTS 中对 yaml 构建定义进行排队,看起来我没有为 VSTS API 调用提供正确的 JSON 正文:
$uri = "https://$($accountName).visualstudio.com/$($projectName)/_apis/build/builds?api-version=4.1"
$body = @{
"definition" = @{
"id" = "$($buildDefinitionId)"
"sourceBranch" = "refs/heads/master"
}
}
这是错误消息:
"error","message":"Unable to resolve the
reference '' to a specific version. Verify the reference exists in the source repository.
我可以确认项目中存在 YAML 构建定义。我查看了一个类似提交的 GitHub 问题,但似乎没有帮助。有任何想法吗?
解决方案
改用此代码:
$body = @{
"definition" = @{
"id" = "$($buildDefinitionId)";
};
"sourceBranch" = "refs/heads/master";
}
推荐阅读
- sql - 使用 VBA 插入 Access 联结表
- qt - 如何让对话框作为独立窗口弹出?
- python - How to use putString() method in pyrebase (Python) Firebase storage
- sql - 数据库网格未正确显示列宽
- git - 为什么升级到 git 2.32 后我所有的本地 git 存储库都是“稀疏结帐”?
- python - 玩家不应穿过墙壁
- python - numpy中具有相同数组的数组的项目差异
- reactjs - React App 中的 Redux 不应该在商店中复制
- amazon-web-services - com.amazonaws.services.s3.model.AmazonS3Exception:您提供的 XML 格式不正确或未针对我们发布的架构进行验证
- html - 下面两种放置方式有什么区别?