Back in March of this year I decided I was unhappy with our PowerShell module deployment process. We have a number of open source PowerShell modules of varying quality that we’ve written to solve some need of ours. Most of them are providing interfaces to consume REST APIs in some kind of task based way. We have no automated testing, no real build process, and our deployment process is just an Azure Automation runbook that copies files whenever there’s a commit to master (plus a push to the PowerShell Gallery). A number of things came together back in March where I started learning about Pester testing and these things called Pipelines.
I found some tutorials, primarily from Warren Frame (ramblingcookiemonster) involving AppVeyor, but I quickly discovered Azure DevOps and moved that way. However I kept what little AppVeyor state of mind I’d developed, mostly because I had no framework to operate under. I was doing most of my work in a single large PowerShell script. I was copying the layouts of his Modules because, well, I didn’t really have any other idea how.
Azure DevOps operates with distinct tasks, so while my way certainly worked, it probably wasn’t fully in the Azure DevOps spirit. Along the way I’ve run into various other patterns. I’ve found the very opinionated PoshCode ModuleBuilder and Azure-Pipelines templates. I’ve made a number of pull requests against Warren’s BuildHelpers module. I’ve left myself wondering the benefits of a single PowerShell script vs multiple tasks in an Azure DevOps Pipelines, or whether I should be compiling my modules into a single monolithic .psm1 or leaving functions in individual files.
I’ve also played around with places to store my modules and ways to deploy them. I have access to an Artifactory instance, but I’ve also played around with Azure Artifacts and even a file share hosted repository. I’ve implemented GitVersion before I knew what GitVersion even was. I’ve learned far more about git than I ever truly wanted to know.
But most importantly, I still feel like I have no idea what I’m doing. I still haven’t settled on a module build template that I’m happy with that I can deploy to all our internal projects. This is a journey I’ve been on for nearly 7 months, and I feel like I’m just getting started. One thing I’ve realized is that this is a somewhat new world, and there’s not a lot of people talking about their PowerShell pipeline workflows and explaining the choices they’ve made. I’ve found lots of opinions but not a lot of justification of those opinions to know if I necessarily agree with the reasoning or not.
So this is my attempt to add my voice to the crowd, documenting my journey, the choices I’ve made, and most importantly why I’ve made them, so people can feel better about disagreeing with me. Hopefully me sharing my journey will help others that are on the same journey, and we can all learn from each other along the way.