flcdrg / au-packages

David's Chocolatey Automatic Packages
MIT License
18 stars 53 forks source link

Add support for --environment and --environmentName parameters #82

Closed dotnetcanuck closed 4 years ago

dotnetcanuck commented 4 years ago

Azure Pipelines has added a feature called Environments, which can be used to deploy applications to Kubernetes clusters, or groups of generic virtual machines.

Registering a virtual machine with an Environment uses the same VSTS/Azure Pipelines Agent that we are all used to, but it uses different command line arguments, that, aside from the PowerShell script that Microsoft provides on the "Add Resource" page, appear to be undocumented.

These code changes do work with the choco package, however, and I was able to register a machine with Azure Pipelines and have it added into an Environment.

The only thing I wasn't able to do was add support for 'tagging' virtual machines that are onboarded. The Azure Agent source code accepts a command line argument (--virtualmachineresourcetags), but it didn't seem to do anything in my testing.

At the very least, this will allow you to install the agent on a VM and register it with Azure Pipelines as an Environment Resource. EDIT: Of course I find the solution after submitting a PR. Support for environment tags added! Thanks to the author of this issue for the solution.

Give me a shout with any questions or concerns.

Thanks!

(Fixes #83)