1
votes

I have a parent pipeline which publish pipeline artifacts.

And the child pipeline which has a parent pipeline added as a resource pipeline and consumes the parent's artifacts.

I would like to programatically (by REST API) create a run of multistage child pipeline and provide the parent pipeline resource.

How to craft a request body for pipelines' run endpoint? According to ms docs PipelineResourceParameters contains only version? Are there any examples how to use it? Is it a resource name and buildnumber?

https://docs.microsoft.com/en-us/rest/api/azure/devops/pipelines/runs/run%20pipeline?view=azure-devops-rest-6.1#pipelineresourceparameters

Where can I find any examples of requests bodies?

1

1 Answers

0
votes

The pipeline resource is set in advance in the pipelines. By default, the pipeline will select last successful run as the resource. We can choose the pipeline resource version when we run the pipeline. enter image description here

Here is my request body sample:

{
  "resources":{
        "pipelines":{
            "Parent":{
                "version":"20201225.1"
            }
        }
    }
}

If you want to find the sample of Rest API, in addition to referring to the examples in the official documentation, you can also check the developer tool (F12) in the browser. For example, run a pipeline manually and check the rest api: enter image description here