Pre and Post job script tasks
This extension contains patched versions of the "BashV3", "CmdLineV2" and "PowerShellV2" tasks. They are built from the latets release that was installed into my Azure DevOps Account.
Each task is extended with a Pre-Job version and a Post-Job version.
You can use these tasks to inject an (inline) script that runs prior to checkout (Pre-job), or as part of the cleanup steps of a job (Post-Job).
The Pre-job tasks can be used to inject a script very early in pipeline. Under normal circumstances, you'd be required to use a custom task or a decorator to do this.
Some of these steps are more useful on the Azure Pipelines Hosted Agents, since you can't change their configuration prior to the job starting.
The post-job tasks can be used to inject a script that will run after the job has completed.
My own uses
I've used these tasks to test scripts I've later included in custom tasks and decorators. That way I did not have to build and publish the extension(s) containing these tasks every time I needed to test something. Examples of my own usage:
And you can find many other people who included pre- and post-job tasks in their extensions. I'm hoping these tasks will make the job of developing these extensions a little easier. And possibly will remove the need for these kinds of extensions for one-of scripts that need to run outside of the job context.