bedrock
bedrock copied to clipboard
CLI pipeline should support AzDO yaml templating to allow easier extension
As a: Developer
I want: The Bedrock CLI to support templating when generating pipelines such as:
-
bedrock service create
-
bedrock hld init
(https://github.com/microsoft/bedrock-cli/issues/56) -
bedrock project init
So that: I can customize and extend GitOps pipeline logic.
Describe the solution you'd like: The end solution should allow conditional configuration. This can be in the form of conditional yaml statements in the AzDO yaml pipeline that can enable/disable reusable templates. I've created a proof of concept here.
An example of what build-update-hld.yaml
could be:
# File: azure-pipelines.yml
trigger:
- master
variables:
- group: quick-start-vg
- name: APP_NAME
value: quick-start-app
stages:
- stage: build
jobs:
- job: run_build_push_acr
pool:
vmImage: ubuntu-latest
steps:
- template: templates/azure-login.yml # Template reference
parameters:
appId: $(SP_APP_ID)
password: $(SP_PASS)
tenantId: $(SP_TENANT)
- template: templates/container-build-strategy.yml # Template reference
parameters:
downloadTools: false
imageRepoType: ACR
imageName: "$(APP_NAME)-$(Build.SourceBranchName)"
imageTag: $(Build.BuildNumber)
buildArgs:
- AZP_POOL
- ACR_NAME
- stage: hld_update
dependsOn: build
condition: succeeded('build')
jobs:
- job: update_image_tag
pool:
vmImage: ubuntu-latest
steps:
- template: templates/git-update-strategy.yml # Template reference
parameters:
downloadFab: true
downloadTools: true
azureContainerRegistry: $(ACR_NAME)
gitUpdateType: HLD
gitRepoURL: $(HLD_REPO)
gitAccessToken: $(PAT)
imageName: "$(APP_NAME)-$(Build.SourceBranchName)"
imageTag: $(Build.BuildNumber)
I would also consider maintaining a library of GitOps focused AzDO templates (and possibly bash scripts) that can be hosted from Bedrock, can be optionally downloaded to local repositories, or be hosted on a user's private repository.
If applicable it might make sense to encapsulate heavily re-used components of the Bedrock CLI GitOps pipelines in Azure DevOps Extension Tasks.
Acceptance Criteria:
- As a user I can easily extend Bedrock CLI generated pipelines with my own AzDO templates and scripts in a clear encapsulated manner.
- There is flexibility of where the templates and script are hosted (Bedrock repo, in the local service repo, in a private 3rd party repo)
Does this require updates to documentation?: Yes