You can use the "Build Completion" trigger in your second pipeline:
Additionally, you can add PowerShell script to queue another build from the parent build. Example:
$user = ""
$token = $env:SYSTEM_ACCESSTOKEN
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user,$token)))
$orgUrl = "$env:SYSTEM_COLLECTIONURI"
$teamProject = "$env:SYSTEM_TEAMPROJECT"
$buildBodyTemplate = "{`"definition`": {`"id`": <build_id>}}"
$restApiQueueBuild = "$orgUrl/$teamProject/_apis/build/builds?api-version=6.0"
function InvokePostRequest ($PostUrl, $body)
{
return Invoke-RestMethod -Uri $PostUrl -Method Post -ContentType "application/json" -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Body $body
}
function RunBuild($buildId)
{
$buildBody = $buildBodyTemplate.Replace("<build_id>", $buildId)
Write-Host $buildBody
$buildresponse = InvokePostRequest $restApiQueueBuild $buildBody
Write-Host $buildresponse
}
RunBuild SECOND_BUILD_ID
Update SECOND_BUILD_ID
to ID of your build definition with tests. Additionally, add access to the security token in the parent build:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…