I need to trigger a child pipeline after a successful run of a parent pipeline. I’m doing this, using the Builds Queue API, since I also need to pass along a template parameter.
My issue is how to associate the two pipelines. When a pipeline is triggered using a normal YAML resource trigger, the triggering pipeline appears in the triggered pipeline with a clickable link like so:
However, when I use an API to trigger the child pipeline, I’m not able to make the triggering parent pipeline appear at all. This makes it hard to keep track of what triggered what.
Is there any way that I can modify this Builds Queue API call to have the triggering pipeline appear just like when using a normal resource trigger?
# Trigger deployment pipeline
RESPONSE=$(curl -X POST
-H "Content-Type: application/json"
-u :$(System.AccessToken)
--data "{
'definition': {
'id': $PIPELINE_ID
},
'templateParameters': '{"deployReason": "automated"}',
'reason': 'buildCompletion',
'project': {'id': $SYSTEM_PROJECTID}
'triggeredByBuild': '{
"definitionId": $SYSTEM_DEFINITIONID,
"id": $BUILD_BUILDID,
"buildNumber": $BUILD_BUILDNUMBER'}
}"
"$SYSTEM_COLLECTIONURI/$SYSTEM_TEAMPROJECT/_apis/build/builds?api-version=7.0")