Skip to main content

Lifecycle with Deploy Approval

This example tracks pre-production and production deployments. Both deployment transitions require a correlated Deploy Approval for the target environment:

  1. registration creates the lifecycle in BOOTSTRAPPED;
  2. an approved deployment in environment priority 1 moves it to DEPLOYED_IN_PREPROD;
  3. an approved deployment in environment priority 0 moves it to DEPLOYED_IN_PROD.

The definition assumes priority 1 is pre-production and priority 0 is production. A System can be retired only from BOOTSTRAPPED.

schema: workflow.definition/v2
macroPhases:
nodes:
- { id: IMPLEMENTING, required: true, label: Implementing, icon: mui:Code }
- { id: OPERATING, required: true, label: Operating, icon: mui:Settings }
- { id: RETIRED, required: true, label: Retired, icon: mui:Clear }
edges:
- { from: IMPLEMENTING, to: OPERATING }
- { from: IMPLEMENTING, to: RETIRED }
- { from: OPERATING, to: RETIRED }
- { from: RETIRED, to: IMPLEMENTING }
- { from: RETIRED, to: OPERATING }
stages:
- name: BOOTSTRAPPED
initial: true
metadata:
{ macroPhase: IMPLEMENTING, label: Bootstrapped, description: System is registered and ready for deployment., icon: mui:Settings }
- name: DEPLOYED_IN_PREPROD
metadata:
{ macroPhase: IMPLEMENTING, label: Deployed in pre-production, description: System is deployed in the pre-production environment., icon: mui:CloudDone }
- name: DEPLOYED_IN_PROD
metadata:
{ macroPhase: OPERATING, label: Deployed in production, description: System is deployed in the production environment., icon: mui:CloudDone }
- name: RETIRED
metadata:
{ macroPhase: RETIRED, label: Retired, description: System is no longer active., icon: mui:Cancel }
transitions:
- id: enroll-system
from: null
to: BOOTSTRAPPED
metadata: { label: Enroll System }
trigger:
type: EVENT
metadata: { label: Register the System }
config:
eventTypes: [builder.system-registered]
- id: deployed-in-preprod
from: BOOTSTRAPPED
to: DEPLOYED_IN_PREPROD
metadata: { label: Deploy to pre-production }
trigger:
type: EVENT
metadata: { label: Deploy to pre-production }
config:
eventTypes: [coordinator.system-provisioning-status-updated]
environmentPriority: 1
where: { eq: { path: payload.newStatus, value: DEPLOYED } }
preconditions:
- id: deploy-approval
type: WORKFLOW_RELATED
metadata: { label: Pre-production deployment approval is complete }
config:
workflowId: deploy-approval
state: DEPLOY_APPROVED
correlator: system-environment-v1
environmentPriority: 1
- id: production-deployed
from: DEPLOYED_IN_PREPROD
to: DEPLOYED_IN_PROD
metadata: { label: Deploy to production }
trigger:
type: EVENT
metadata: { label: Deploy to production }
config:
eventTypes: [coordinator.system-provisioning-status-updated]
environmentPriority: 0
where: { eq: { path: payload.newStatus, value: DEPLOYED } }
preconditions:
- id: deploy-approval
type: WORKFLOW_RELATED
metadata: { label: Production deployment approval is complete }
config:
workflowId: deploy-approval
state: DEPLOY_APPROVED
correlator: system-environment-v1
environmentPriority: 0
- id: preprod-undeployed
from: DEPLOYED_IN_PREPROD
to: BOOTSTRAPPED
metadata: { label: Undeploy from pre-production }
trigger:
type: EVENT
metadata: { label: Undeploy from pre-production }
config:
eventTypes: [coordinator.system-provisioning-status-updated]
environmentPriority: 1
where: { eq: { path: payload.newStatus, value: NOT_DEPLOYED } }
- id: production-undeployed-preprod-deployed
from: DEPLOYED_IN_PROD
to: DEPLOYED_IN_PREPROD
metadata: { label: Return to pre-production }
trigger:
type: EVENT
metadata: { label: Undeploy from production }
config:
eventTypes: [coordinator.system-provisioning-status-updated]
environmentPriority: 0
where: { eq: { path: payload.newStatus, value: NOT_DEPLOYED } }
when:
type: EXPRESSION
value: { eq: { path: deployment.priority.1.status, value: deployed } }
- id: production-undeployed-bootstrapped
from: DEPLOYED_IN_PROD
to: BOOTSTRAPPED
metadata: { label: Return to bootstrapped }
trigger:
type: EVENT
metadata: { label: Undeploy from production }
config:
eventTypes: [coordinator.system-provisioning-status-updated]
environmentPriority: 0
where: { eq: { path: payload.newStatus, value: NOT_DEPLOYED } }
when:
type: EXPRESSION
value:
in:
path: deployment.priority.1.status
values: [not-deployed, partially-deployed, provisioning, corrupt]
- id: system-unregistered-from-bootstrapped
from: BOOTSTRAPPED
to: RETIRED
metadata: { label: Retire System }
trigger:
type: EVENT
metadata: { label: Unregister System }
config:
eventTypes: [builder.system-unregistered]
- id: system-reregistered
from: RETIRED
to: BOOTSTRAPPED
metadata: { label: Reactivate System }
trigger:
type: EVENT
metadata: { label: Register the System again }
config:
eventTypes: [builder.system-registered]

The Deploy Approval workflow must already have processed the deployment request for the same System and target environment. System Lifecycle does not create that approval request.

system-environment-v1 correlates by System URN and environment. Release version is not part of this lookup. The current implementation searches for an instance already in DEPLOY_APPROVED; a newer REJECTED instance does not invalidate an older matching approved instance.