[英]How can I run my integration tests on DevOps for multiple services?
我希望我的服务在其中一项发布时触发相同的测试。这可能吗?谢谢!
可以在服务流水线中调用create release rest api触发release运行集成测试。 请参阅以下步骤:
1,在每个服务管道的末尾添加一个脚本任务来调用create release rest api。例如,在powershell任务中运行以下脚本。
$rurl="https://vsrm.dev.azure.com/{org}/{proj}/_apis/release/releases?api-version=6.0-preview.8"
# the definitionId is the definitionId of release pipeline of the integration tests
$body='{
"definitionId": 3
}'
$result1 = Invoke-RestMethod -Uri $rurl -Headers @{authorization = "Bearer $env:SYSTEM_ACCESSTOKEN"} -Method post -Body $body -ContentType "application/json"
您可以从地址栏中获取测试发布管道的 definitionId。 Go 发布页面 --> 点击运行测试的发布管道 --> 你会在地址栏看到definitionId。
如果服务管道与测试发布管道位于不同的项目中。 您需要go测试发布管道安全设置页面以允许服务管道创建发布权限。(搜索{Service ProjectName} Build Service ({OrganizationName})
)
这样,当服务管道完成释放服务时,将执行最后的 powershell 任务。 powershell 任务中的脚本将调用 create release rest api。然后将触发测试发布管道并运行集成测试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.