Search code examples
linuxazureazure-devopsazure-devops-rest-apiazure-devops-pipelines

Azure Devops pipeline , way to know when pipeline is done , using self hosted agent


I have an Azure Pipeline which I invoke it using azure rest API

https://dev.azure.com/xxx/xxx_connection/_apis/pipelines/2/runs

All working great, I'm sending the source files from install Self Hosted Linux Agent to azure and getting them back compiled into the Self Hosted Linux Agent.

My question is how can I know when the pipeline is done in the server that is hosting the Self Hosted Linux Agent?

Is there any callback? or API I can invoke and query the if the pipeline job is done?
or just doing while loop on the directory where I accepting to get the compiled products? last option I want to avoid.


Solution

  • You can also check out below ways to know if the pipeline is done.

    1, Using Runs-Get or Latest - Get API to get the build result as mentioned by Shayki Abramczyk.

    2, You can set up a service hook. For below example a web hook which is triggered on the the completion the selected build pipeline.

    enter image description here

    3, You can check out the extension CatLight. CatLight app will notify you on build start and completion.

    4,Create a custom notification on the build completed event and subscribe. You will be notified by email when the pipeline completed. Check the tutorial here for more information.