deployments
Creates, updates, deletes, gets or lists a deployments resource.
Overview
| Name | deployments |
| Type | Resource |
| Id | cloudflare.workers.deployments |
Fields
The following fields are returned by SELECT queries:
- get
- list
Get Deployment response.
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | |
annotations | object | |
author_email | string (email) | |
created_on | string (date-time) | |
source | string | (example: api) |
strategy | string | (percentage) |
versions | array |
List Deployments response.
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | |
annotations | object | |
author_email | string (email) | |
created_on | string (date-time) | |
source | string | (example: api) |
strategy | string | (percentage) |
versions | array |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | account_id, script_name, deployment_id | Get information about a Worker Deployment. | |
list | select | account_id, script_name | List of Worker Deployments. The first deployment in the list is the latest deployment actively serving traffic. | |
create | insert | account_id, script_name, strategy, versions | force | Deployments configure how Worker Versions are deployed to traffic. A deployment can consist of one or two versions of a Worker. |
delete | delete | account_id, script_name, deployment_id | Delete a Worker Deployment. The latest deployment, which is actively serving traffic, cannot be deleted. All other deployments can be deleted. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
account_id | string | The Cloudflare account ID. |
deployment_id | string (uuid) | |
script_name | string | The Worker script name. |
force | boolean | If set to true, the deployment will be created even if normally blocked by something such rolling back to an older version when a secret has changed. |
SELECT examples
- get
- list
Get information about a Worker Deployment.
SELECT
id,
annotations,
author_email,
created_on,
source,
strategy,
versions
FROM cloudflare.workers.deployments
WHERE account_id = '{{ account_id }}' -- required
AND script_name = '{{ script_name }}' -- required
AND deployment_id = '{{ deployment_id }}' -- required
;
List of Worker Deployments. The first deployment in the list is the latest deployment actively serving traffic.
SELECT
id,
annotations,
author_email,
created_on,
source,
strategy,
versions
FROM cloudflare.workers.deployments
WHERE account_id = '{{ account_id }}' -- required
AND script_name = '{{ script_name }}' -- required
;
INSERT examples
- create
- Manifest
Deployments configure how Worker Versions are deployed to traffic. A deployment can consist of one or two versions of a Worker.
INSERT INTO cloudflare.workers.deployments (
annotations,
strategy,
versions,
account_id,
script_name,
force
)
SELECT
'{{ annotations }}',
'{{ strategy }}' /* required */,
'{{ versions }}' /* required */,
'{{ account_id }}',
'{{ script_name }}',
'{{ force }}'
RETURNING
errors,
messages,
result,
success
;
# Description fields are for documentation purposes
- name: deployments
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the deployments resource.
- name: script_name
value: "{{ script_name }}"
description: Required parameter for the deployments resource.
- name: annotations
value:
workers/message: "{{ workers/message }}"
workers/triggered_by: "{{ workers/triggered_by }}"
- name: strategy
value: "{{ strategy }}"
valid_values: ['percentage']
- name: versions
value:
- percentage: {{ percentage }}
version_id: "{{ version_id }}"
- name: force
value: {{ force }}
description: If set to true, the deployment will be created even if normally blocked by something such rolling back to an older version when a secret has changed.
description: If set to true, the deployment will be created even if normally blocked by something such rolling back to an older version when a secret has changed.
DELETE examples
- delete
Delete a Worker Deployment. The latest deployment, which is actively serving traffic, cannot be deleted. All other deployments can be deleted.
DELETE FROM cloudflare.workers.deployments
WHERE account_id = '{{ account_id }}' --required
AND script_name = '{{ script_name }}' --required
AND deployment_id = '{{ deployment_id }}' --required
;