Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the "Pre-job" and "Post-job" tasks appearing in Azure DevOps Pipeline Logs?

I've got my Pipeline tasks as follows: (key one is Signing and aligning APK file(s) one).

enter image description here

When I am looking at logs of the build(s), apart from the Signing and aligning APK file(s) task logs there I also see Pre-job: Signing and aligning APK file(s) one and Post-job: ... ones (same as for Checkout).

However, I don't quite understand what those tasks are and how it appeared I have them in logs? I can't find any documentation related to that. And, correspondingly, considering there are the "Pre-job" tasks, if there is any way to define my own tasks executing before the Pipeline build starts?

enter image description here

like image 244
Agat Avatar asked Jan 28 '23 05:01

Agat


1 Answers

A task can define pre- and post- steps. These will be added to the initialization phase of the job and to the cleanup stage. In the case of the signing task I can imagine it helps ensure the secrets are properly cleaned up when the job is finished.

Especially on a shared agent this can be important, because not cleaning up after the fact may lead to the secrets staying around on the agent and potential "capture" by other jobs running on the same machine.

You can dig into what these jobs do exactly by looking at the sources:

  • https://github.com/Microsoft/azure-pipelines-tasks/blob/master/Tasks/AndroidSigningV3/task.json#L155-L171
  • Download the secure files: https://github.com/Microsoft/azure-pipelines-tasks/blob/master/Tasks/AndroidSigningV3/preandroidsigning.ts
  • Delete the secure files: https://github.com/Microsoft/azure-pipelines-tasks/blob/master/Tasks/AndroidSigningV3/postandroidsigning.ts
like image 100
jessehouwing Avatar answered Mar 05 '23 16:03

jessehouwing