(Part 6 in a 10-part series)
As it is with naming, creating good reusable pipelines and templates is very hard to get right. I look at it in a layered approach much like this yummy chocolate cake:
Layer 1: Pipelines
Pipelines are the outermost layer and are unique to each project. They contain things like variable group names and environment names that you are concerned with. Here’s an example:
Layer 2: Pipes
Pipes are where workflows are composed, for example, create Azure Resources using Bicep, compile an application, then deploy the binaries to the Azure Resources, like this example:
Layer 3: Templates
The template layer is where the real work gets accomplished. In this example, a main.bicep file is deployed to Azure using variables found in the variableGroup passed in the parameters and the current environment from the parent pipe step to build those resources with unique names. (Intermediate steps hidden in lines 34-77 provide some debugging information, which is quite useful when setting these up for the first time.)
By breaking these pipelines up into layers, they become easily reusable by just creating a very simple Layer 1 Pipeline which defines what workflows that should be executed, what variables should be used, and what environments should be deployed.
Next step: What is “azd” and why do I care?
Define variables – Azure Pipelines