VSTS API中排队的Yaml构建导致无法解决参考错误

时间:2018-06-19 18:21:42

标签: azure-devops

我正在使用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问题,但似乎无济于事。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

改为使用以下代码:

Thisisonlyatéstreally