By default, you're not able to use Custom Conditions on Deployment Group Tags. This pipeline step adds the tags of the current deployment group target to your pipeline variables.
This task can be useful for you if you encountered the specific situation I encountered:
- You have a deployment group that contains lots of different machines with different tags describing individual differences.
- You have one generic pipeline that can release to any of the machines in the deployment group, but only one at a time using tag filters.
- You want to be able to execute more complex logic in custom scripts or using custom conditions against the current machine tags.
Previously, you would have to add a Deployment Group Job with the tag conditions, but if you wanted to add for example ten pipeline steps with the different tag conditions, you would have to add ten Deployment Group Jobs. Using this extension, you can start using target Tags in scripts, custom conditions and more. This will allow you to conditionally run a single step based on whether the current Deployment Target has a certain tag or not.
It's really quite simple:
- The pipeline step is executed on the deployment group machine.
- It gets the attached tags of the machine, and saves them as
comma,separated,tags
in your Release Variables. - You can now use the release variable in custom conditions, scripts or more!
This repository was created based on the "Create a custom pipelines task" guide by Microsoft.
- Clone the repository
- Perform
npm install
in thebuildandreleasetask
directory - Make your changes
- Run
tsc
in thebuildandreleasetask
directory - To package, first install the tfx-cli using
npm i -g tfx-cli
- Run
tfx extension create --manifest-globs vss-extension.json
to create the package - Upload the package to the extension gallery, or load it in your own Azure DevOps environment!
Proudly developed by Wessel Loth with help from all the Arcadians at Arcady during Hacktoberfest 2021.