Using DevOps as Code With Software Delivery
Note: This feature is being released in beta. There will be some changes in the next major Release version which are likely to break your YAML templates, so you should plan accordingly.
You can use DevOps as Code to add and generate Software Delivery items, including delivery patterns and all delivery tasks.
XL Apply
The YAML for applying Software Delivery elements with xl apply
will look like the following:
apiVersion: xl-release/v1
kind: Templates
spec:
- directory: folder1
children:
- pattern: Pattern1
stages:
- stage: Stage1
transition:
name: Transition1
type: delivery.Transition
- stage: Stage2
- template: Template1
phases:
- phase: New Phase
tasks:
- name: CreateDelivery
type: delivery.CreateDelivery
^title: Test
pattern: folder1/Pattern1
variableMapping:
pythonScript.deliveryId: ${deliveryId1}
- name: FindOrCreateDelivery
type: delivery.FindOrCreateDelivery
pattern: folder1/Pattern1
variableMapping:
pythonScript.deliveryId: ${deliveryId1}
- name: MarkTrackedItems
type: delivery.MarkTrackedItems
trackedItems:
- item1
- item2
stage: Stage1
^status: SKIPPED
delivery: ${deliveryId1}
pattern: folder1/Pattern1
- name: RegisterTrackedItems
type: delivery.RegisterTrackedItems
trackedItems:
- item1
- item2
delivery: ${deliveryId1}
- name: WaitForStage
type: delivery.WaitForStage
stage: Stage1
delivery: ${deliveryId1}
pattern: folder1/Pattern1
- name: WaitForTrackedItems
type: delivery.WaitForTrackedItems
trackedItems:
- item1
- item2
stage: Stage1
^status: NOT_READY
delivery: ${deliveryId1}
pattern: folder1/Pattern1
variables:
- type: xlrelease.StringVariable
key: deliveryId1
requiresValue: false
showOnReleaseStart: false
riskProfile: Default risk profile
The example above will create the following items:
- A new folder
- A new delivery pattern, with...
- Two delivery stages
- A transition from Stage1
- A release template with...
- A Create delivery task
- A Find or create delivery task
- A Mark tracked items task which creates two tracked items in the delivery
- A Register tracked items task
- A Wait for stage task
- A Wait for tracked items task
Important in the example above it is necessary to use the
^
tag for some delivery task fields, such astitle
andstatus
. This ensures that they will inherit the fields from the correct task class.
For a more detailed sample YAML file, see the Delivery Patterns tutorial.
XL Generate
In xl generate
, the --deliveryPatterns
flag will add all the delivery patterns to the generated YAML file, including their stages and transitions. For more information, see Release generate-specific flags.