Skip to main content

Lifecycle action specifications

Before you start

Design your action specifications

Now that you have a custom scope specification, bring it to life by designing actions that nullplatform will invoke at different points in the scope's lifecycle.

Here are some key design questions:

QuestionGuidance
Which input parameters are required to create the custom scope?This defines the contents of the JSON schema under the attributes field.
What optional custom actions should be available?Think about actions that support specific operations, like adjusting traffic percentage during blue-green deployments.

Lifecycle: execution flow

The execution flow for lifecycle actions is illustrated below:

Define all required actions

Most custom scopes require at least these actions:

  • create or delete the scope
  • Handle deployments, like triggering initial deployments or finalizing blue-green ones

In addition, you can define optional custom actions to extend your scope’s functionality. This means that you'll likely have to design and create several actions for a custom scope.

Your actions should use one of the following types: create, update, or custom.

Action specification reference

NameAction typeParametersDescriptionRequired
Create scopecreatescope_idTriggered during scope creation to provision infrastructure independent of app versions (e.g., DNS).Yes
Start initialcustomscope_id, deployment_idStarts an initial deployment, typically the first or one after a scope restart.Yes
Start blue greencustomscope_id, deployment_idInitiates a blue-green deployment.Yes
Switch trafficcustomscope_id, deployment_id, desired_trafficAdjusts traffic percentage during blue-green deployments.No
Finalize blue greencustomscope_id, deployment_idCleans up old infrastructure after blue-green deployment completion.Yes
Rollback deploymentcustomscope_id, deployment_idReverts to the previous deployment and removes the new infrastructure.Yes
Delete deploymentcustomscope_id, deployment_idDeletes deployment infrastructure when the active scope is stopped.No
Update scopeupdatescope_idUpdates the scope’s infrastructure if changes are required.No
Delete scopecustomscope_idDeletes app-version-independent infrastructure during scope deletion.Yes

Parameters

Each action must define the following:

  • parameters: inputs required to execute the action (as a JSON schema)
UI Schema

See the UI schema reference section for more information on how to control the fields in the UI.

Creating action specifications

To define the actions for your custom scope, use the CLI or API.

While not strictly required, most custom scopes rely on actions to create, update, or delete the scope and to manage scope workflows.

When using the UI, nullplatform automatically looks up the corresponding action specifications and creates instances as needed. If you're integrating programmatically, you’ll need to trigger these actions explicitly.

Action types

Use the type field on the action specification to distinguish between create, update, and custom actions.

Create scope

np service-specification action-specification create \ 
--serviceSpecificationId $service-spec-id \
--body '{
"name": "Create scope",
"type": "create",
"parameters": { // defines the input requirements for the action
"schema": {
"type": "object",
"required": ["scope_id"], // required parameter to create a custom scope
"properties": {
"scope_id": {
"type": "string"
}
}
},
"values": {}
},
"results": {
"schema": {
"type": "object",
"properties": {}
},
"values": {}
}
}'

Start initial

np service-specification action-specification create \
--serviceSpecificationId $service-spec-id \
--body '{
"name": "Start initial",
"type": "custom",
"parameters": { // defines the input requirements for the action
"schema": {
"type": "object",
"required": ["scope_id", "deployment_id"], // required parameters to start initial
"properties": {
"scope_id": {
"type": "string"
},
"deployment_id": {
"type": "string"
}
}
},
"values": {}
},
"results": {
"schema": {
"type": "object",
"properties": {}
},
"values": {}
}
}'

Start blue green

np service-specification action-specification create \
--serviceSpecificationId $service-spec-id \
--body '{
"name": "Start blue green",
"type": "custom",
"parameters": { // defines the input requirements for the action
"schema": {
"type": "object",
"required": ["scope_id", "deployment_id"], // required parameters to start blue green
"properties": {
"scope_id": {
"type": "string"
},
"deployment_id": {
"type": "string"
}
}
},
"values": {}
},
"results": {
"schema": {
"type": "object",
"properties": {}
},
"values": {}
}
}'

Finalize blue green

np service-specification action-specification create \
--serviceSpecificationId $service-spec-id \
--body '{
"name": "Finalize blue green",
"type": "custom",
"parameters": { // defines the input requirements for the action
"schema": {
"type": "object",
"required": ["scope_id", "deployment_id"], // required parameters to finalize blue green
"properties": {
"scope_id": {
"type": "string"
},
"deployment_id": {
"type": "string"
}
}
},
"values": {}
},
"results": {
"schema": {
"type": "object",
"properties": {}
},
"values": {}
}
}'

Rollback deployment

np service-specification action-specification create \
--serviceSpecificationId $service-spec-id \
--body '{
"name": "Roll back deployment",
"type": "custom",
"parameters": { // defines the input requirements for the action
"schema": {
"type": "object",
"required": ["scope_id", "deployment_id"], // required parameters to roll back deployment
"properties": {
"scope_id": {
"type": "string"
},
"deployment_id": {
"type": "string"
}
}
},
"values": {}
},
"results": {
"schema": {
"type": "object",
"properties": {}
},
"values": {}
}
}'

Delete deployment

np service-specification action-specification create \
--serviceSpecificationId $service-spec-id \
--body '{
"name": "Delete deployment",
"type": "custom",
"parameters": { // defines the input requirements for the action
"schema": {
"type": "object",
"required": ["scope_id", "deployment_id"], // required parameters to roll back deployment
"properties": {
"scope_id": {
"type": "string"
},
"deployment_id": {
"type": "string"
}
}
},
"values": {}
},
"results": {
"schema": {
"type": "object",
"properties": {}
},
"values": {}
}
}'

Update scope

np service-specification action-specification create \
--serviceSpecificationId $service-spec-id \
--body '{
"name": "Update scope",
"type": "update",
"parameters": { // defines the input requirements for the action
"schema": {
"type": "object",
"required": ["scope_id"], // required parameters to update deployment
"properties": {
"scope_id": {
"type": "string"
}
}
},
"values": {}
},
"results": {
"schema": {
"type": "object",
"properties": {}
},
"values": {}
}
}'

Delete scope

np service-specification action-specification create \
--serviceSpecificationId $service-spec-id \
--body '{
"name": "Delete scope",
"type": "custom",
"parameters": { // defines the input requirements for the action
"schema": {
"type": "object",
"required": ["scope_id"], // required parameters to delete deployment
"properties": {
"scope_id": {
"type": "string"
}
}
},
"values": {}
},
"results": {
"schema": {
"type": "object",
"properties": {}
},
"values": {}
}
}'