API to Get All Tasks to be Executed in the Azure DevOps Pipeline

Viewed 332

Is there a way of getting the order of all tasks running in a build pipeline. As we are building a pipeline decorator, we want to know if there is a way to check if the pipeline has specific tasks. We tried using the timeline api but it will only display all jobs and tasks that have been executed or currently executing. As we are executing the pipeline decorator at the start, we want to get all tasks to be executed in the pipeline.

1 Answers

There isn't such an API to get all tasks to be executed (including the decorator ones) directly in Azure DevOps Pipeline.

However we can get the order of all tasks running from the logs of a build pipeline by calling the Get Build Logs REST API, and then calling the Get Build Log REST API to get the specific task log to get the specific task name. It will also include the auto-injected decorator tasks.

But it has the reverse order from the response. For example,in below screenshot the task showed in log1 is the last task running in the pipeline.

enter image description here

Related