How to run your own maintenance job on Azure DevOps pipelines

Updated: 19 Jul 2023 - Revised the post to use Az CLI Task as opposed to a PowerShell Task Updated: 29 Aug 2024 - Revised the PowerShell as original version was not working. Also see follow up post on using Workload Identity federation Background Azure DevOps Pipelines have a built in mechanism to run maintenance jobs on a schedule. This is great for cleaning out old temporary data, but what if you want to run your own maintenance job?...

July 12, 2023 · 5 min · Richard Fennell

Bit rot is killing my pipelines

In a modern hybrid cloud world we have to accept constant change as the norm. You can’t just build something and forget about it. You have to keep it up to date as newer tools/libraries appear. This is to at least address security issues, even if you don’t want to adopt the new features. So I am expecting a degree of maintenance work on my Azure DevOps pipelines. However, this is becoming more awkward as many of the tasks used by Azure Pipelines, even ones from Microsoft, are themselves not being maintained....

April 26, 2023 · 2 min · Richard Fennell

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....

March 8, 2023 · 1 min · Richard Fennell

Getting x86 .NET 3.x tests running on the latest Azure Devops hosted agents

Background At Black Marble we have our own private build agents, but they are built using the same Packer process as the Microsoft hosted ones. I recently rebuilt our agents to match the latest version of the hosted agents, and I ran into an issue with some .NET 3.1 based x86 MSTests. The tests were failing with the following error: A total of 34 test files matched the specified pattern. ##[error]Testhost process exited with error: A fatal error occurred....

March 6, 2023 · 2 min · Richard Fennell

Getting "cannot find path" error using Install-Package

Background I was recently trying to use PowerShelGet Install-Package to install a module from an Azure DevOps Artifacts hosted PowerShell Gallery using the following script # For authentication use a PAT as the password, UID can be anything $PATcreds = Get-Credential Register-PSRepository -Name BM -SourceLocation 'https://pkgs.dev.azure.com/<org>/_packaging/PowerShell/nuget/v2' -PublishLocation 'https://pkgs.dev.azure.com/<org>/_packaging/PowerShell/nuget/v2' -InstallationPolicy Trusted Install-Package BlackMarble.Package -Source BM -Credential $PATcreds The script did not work I was getting the error Install-Package : Cannot find the path ‘C:\Users<user>\AppData\Local\Temp\936930114\BlackMarble....

February 27, 2023 · 1 min · Richard Fennell

What happens when you link an Azure DevOps Variable Group to an Azure Key Vault?

Background It is a really useful feature that you can expose Key Vault stored secrets as Azure DevOps pipeline variables via a variable group, but what happens when you do this? And what can you do if you try to expose too many variables? I was recently working on a system where there was an increasing number of Key Vault secrets that were being exposed as variables via a variable group....

February 13, 2023 · 2 min · Richard Fennell

New features for my Azure DevOps Release Notes Extension

Over the past couple of weeks, I have shipped three user-requested features for my Azure DevOps Release Notes Extension Generate multiple documents in a single run You can now specify multiple templates and output files. This allows a single instance of the task to generate multiple release note documents with different formats/content. This is useful when the generation of the dataset is slow, but you need a variety of document formats for different consumers....

October 30, 2021 · 2 min · Richard Fennell

Added Manual Test Plan support to my Azure DevOps Cross-Platform Release notes Task

I have just release 3.46.4 of my Azure DevOps Cross-Platform release Notes task which adds support for generating release notes based on the results of Azure DevOps Test Plans. There has been support in the task for automated tests, run as part of the build or release process, for a while. However, until this release, there was no way to generate release notes based on manual tests. Manual Test results are now made available to the templating engine using two new objects:...

March 3, 2021 · 2 min · Richard Fennell

How to do local template development for my Cross platform Release notes task

The testing cycle for Release Notes Templates can be slow, requiring a build and release cycle. To try to speed this process for users I have created a local test harness that allows the same calls to be made from a development machine as would be made within a build or release. However, running this is not as simple was you might expect so please read the instruction before proceeding....

June 10, 2020 · 3 min · Richard Fennell

Another feature for my Cross Platform Release Notes Azure DevOps Extension&ndash;access to test results

Over the weekend I got another new feature for my Cross Platform Release Notes Azure DevOps Extension working. The test results associated with build artefacts or releases are now exposed to Handlebars based templates. The new objects you can access are: In builds tests – all the test run as part of current build In releases tests – all the test run as part of any current build artefacts or previous to the running of the release notes task within a release environment...

May 18, 2020 · 1 min · Richard Fennell