Are Built-In Azure DevOps Tasks Evil - The Good(ish)
In the previous post on Azure DevOps tasks I spoke about my issues with Azure DevOps Tasks and promised to write about some of the good things about them. And one of those positives is the fact that someone has figured out how to do X and feels that they can contribute to the community by publishing it to the marketplace. If inputs are required (and the most likely are) then they can use things like drop-downs or define the data types to help make it easier to setup. Hints and descriptions can be added to the UI, and links to other resources can be added.
And there also… actually I think that is pretty much it! Having written a task and published it I can say that there’s not much else I can say as a positive that doesn’t apply to other ways of sharing tasks. In my case, I wrote a task that would update the version number of a PowerShell module and publish it to PSGallery. It was somewhat unimaginatively called PowerShellGalleryPublisher. Anyway, this relatively simple module was a real pain to test, mainly because there’s loads of different types of agents to install and run the task on. And ultimately all the effort in maintaining, testing and packaging of this task is an awful lot of trouble for less than 100 lines of code.
So I eventually got sick of it and decided to abandon the task and create a PowerShell Module. I don’t remember why I called it Spiny, I was probably playing a lot of Mario at the time. Anyway, with this module I could run loads of Pester tests against PS7 on one hosted agent and be confident that it works on other types of agents. Also the ‘how to use it’ required a bit of YAML. And even better than the task, it could be used locally. And in somewhat of a circular reference, the module uses itself to publish new versions. This is the ultimate in DevOps!
To come back to the original question: are built-in tasks in Azure DevOps evil? I’ll say no, because some of the pipelines I have written so use ones written by Microsoft, but they are largely a waste of time. If you are tempted to write one I urge you not to and instead write a library/module/whatever and publish it to a package maanger like pypi or PowerShell Gallery, so that deployment processes are not tied to one tool. If you use one I would strongly encourage you to look at alternatives before making the decision.