Pinning specific Azure DevOps task versions

I make every effort keep all my Azure DevOps Pipeline extensions reliable as I know they are used by many people, but mistakes happen.

Yesterday I released an updated version of my ReleaseNotes task that introduced a bug if the pipeline produced no artifacts. I am pleased to say I have fixed the bug, and addressed this gap in my test coverage.

However, this did mean for about 12 hours if you are using this task in a pipeline that did not produce artifacts, maybe one that just deployed consumed artifacts from other pipelines, you had a failing pipeline.

In this case all is not lost, as there is a feature of YAML pipelines I only recently discovered.

I knew you could select a specific major version of a task (as you can with Classic Builds and Releases) e.g.

1- task: XplatGenerateReleaseNotes@3

or

1- task: XplatGenerateReleaseNotes@4

However, did you know you can also pin a specific version of a task e.g.

1- task: XplatGenerateReleaseNotes@4.6.2

Thus allowing you to pick any version you wish, and not just the major version. A great way to lock down your pipelines to a known good version of a task, whether as a short term fix or a long term audit control.