microsoft / azure-pipelines-agent

Azure Pipelines Agent 🚀
MIT License
1.72k stars 867 forks source link

[Question]: How to order Post-Jobs in a build pipeline? #5043

Open RainerMuehlberger opened 4 days ago

RainerMuehlberger commented 4 days ago

Describe your question

Hello,

for cleaning static agent purposes after a run we are using a self implemented task "Post Build Cleanup" with "postjobexecution" property to configure the task automatically into the post-job section of a build pipeline.

Now we realize that this task creates issues with a automatically created Post-Job: "nuget pipeline cache" which cannot work anymore because it is executed after the cleaning task. The "nuget pipeline cache" task must be executed before the cleaning task.

My question is: Do I have the possibility to change the order of the post-jobs? And when yes, where could I change this?

Thank you very much.

Greetings, Rainer

Versions

Environment type (Please select at least one enviroment where you face this issue)

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Operation system

Windows Server 2019 Standard

Version controll system

git

Azure DevOps Server Version (if applicable)

No response

aleksandrlevochkin commented 3 days ago

Hi @RainerMuehlberger thank you for the question. If my understanding is correct, the post-jobs steps are executed in reverse order compared to the placements of tasks in a pipeline, judging by this code. I think to fix your issue the definition of the "Post Build Cleanup" task should be placed before the "nuget pipeline cache" task in the pipeline.