deployments
Creates, updates, deletes, gets or lists a deployments resource.
Overview
| Name | deployments |
| Type | Resource |
| Id | cloudflare.pages.deployments |
Fields
The following fields are returned by SELECT queries:
- get
- list
Get deployment info response.
| Name | Datatype | Description |
|---|---|---|
id | string | Id of the deployment. (example: f64788e9-fccd-4d4a-a28a-cb84f88f6) |
project_id | string | Id of the project. (example: 7b162ea7-7367-4d67-bcde-1160995d5) |
short_id | string | Short Id (8 character) of the deployment. (example: f64788e9) |
project_name | string | Name of the project. (example: this-is-my-project-01) |
aliases | array | A list of alias URLs pointing to this deployment. |
build_config | object | Configs for the project build process. |
created_on | string (date-time) | When the deployment was created. (example: 2021-03-09T00:55:03.923456Z) |
deployment_trigger | object | Info about what caused the deployment. |
env_vars | object | Environment variables used for builds and Pages Functions. |
environment | string | Type of deploy. (preview, production) (example: preview) |
is_skipped | boolean | If the deployment has been skipped. |
latest_stage | object | The status of the deployment. |
modified_on | string (date-time) | When the deployment was last modified. (example: 2021-03-09T00:58:59.045655Z) |
source | object | Configs for the project source control. |
stages | array | List of past stages. |
url | string | The live URL to view this deployment. (example: https://f64788e9.ninjakittens.pages.dev) |
uses_functions | boolean | Whether the deployment uses functions. |
Get deployments response.
| Name | Datatype | Description |
|---|---|---|
id | string | Id of the deployment. (example: f64788e9-fccd-4d4a-a28a-cb84f88f6) |
project_id | string | Id of the project. (example: 7b162ea7-7367-4d67-bcde-1160995d5) |
short_id | string | Short Id (8 character) of the deployment. (example: f64788e9) |
project_name | string | Name of the project. (example: this-is-my-project-01) |
aliases | array | A list of alias URLs pointing to this deployment. |
build_config | object | Configs for the project build process. |
created_on | string (date-time) | When the deployment was created. (example: 2021-03-09T00:55:03.923456Z) |
deployment_trigger | object | Info about what caused the deployment. |
env_vars | object | Environment variables used for builds and Pages Functions. |
environment | string | Type of deploy. (preview, production) (example: preview) |
is_skipped | boolean | If the deployment has been skipped. |
latest_stage | object | The status of the deployment. |
modified_on | string (date-time) | When the deployment was last modified. (example: 2021-03-09T00:58:59.045655Z) |
source | object | Configs for the project source control. |
stages | array | List of past stages. |
url | string | The live URL to view this deployment. (example: https://f64788e9.ninjakittens.pages.dev) |
uses_functions | boolean | Whether the deployment uses functions. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | deployment_id, project_name, account_id | Fetch information about a deployment. | |
list | select | project_name, account_id | env, page, per_page | Fetch a list of project deployments. |
create | insert | project_name, account_id | Start a new deployment from production. The repository and account must have already been authorized on the Cloudflare Pages dashboard. | |
delete | delete | deployment_id, project_name, account_id | force | Delete a deployment. |
retry | exec | deployment_id, project_name, account_id | Retry a previous deployment. | |
rollback | exec | deployment_id, project_name, account_id | Rollback the production deployment to a previous deployment. You can only rollback to succesful builds on production. |
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 | |
project_name | string | The Pages project name. |
env | string | |
force | boolean | |
page | integer | |
per_page | integer |
SELECT examples
- get
- list
Fetch information about a deployment.
SELECT
id,
project_id,
short_id,
project_name,
aliases,
build_config,
created_on,
deployment_trigger,
env_vars,
environment,
is_skipped,
latest_stage,
modified_on,
source,
stages,
url,
uses_functions
FROM cloudflare.pages.deployments
WHERE deployment_id = '{{ deployment_id }}' -- required
AND project_name = '{{ project_name }}' -- required
AND account_id = '{{ account_id }}' -- required
;
Fetch a list of project deployments.
SELECT
id,
project_id,
short_id,
project_name,
aliases,
build_config,
created_on,
deployment_trigger,
env_vars,
environment,
is_skipped,
latest_stage,
modified_on,
source,
stages,
url,
uses_functions
FROM cloudflare.pages.deployments
WHERE project_name = '{{ project_name }}' -- required
AND account_id = '{{ account_id }}' -- required
AND env = '{{ env }}'
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
;
INSERT examples
- create
- Manifest
Start a new deployment from production. The repository and account must have already been authorized on the Cloudflare Pages dashboard.
INSERT INTO cloudflare.pages.deployments (
_headers,
_redirects,
_routes.json,
_worker.bundle,
_worker.js,
branch,
commit_dirty,
commit_hash,
commit_message,
functions-filepath-routing-config.json,
manifest,
pages_build_output_dir,
wrangler_config_hash,
project_name,
account_id
)
SELECT
'{{ _headers }}',
'{{ _redirects }}',
'{{ _routes.json }}',
'{{ _worker.bundle }}',
'{{ _worker.js }}',
'{{ branch }}',
'{{ commit_dirty }}',
'{{ commit_hash }}',
'{{ commit_message }}',
'{{ functions-filepath-routing-config.json }}',
'{{ manifest }}',
'{{ pages_build_output_dir }}',
'{{ wrangler_config_hash }}',
'{{ project_name }}',
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;
# Description fields are for documentation purposes
- name: deployments
props:
- name: project_name
value: "{{ project_name }}"
description: Required parameter for the deployments resource.
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the deployments resource.
- name: _headers
value: "{{ _headers }}"
description: |
Headers configuration file for the deployment.
- name: _redirects
value: "{{ _redirects }}"
description: |
Redirects configuration file for the deployment.
- name: _routes.json
value: "{{ _routes.json }}"
description: |
Routes configuration file defining routing rules.
- name: _worker.bundle
value: "{{ _worker.bundle }}"
description: |
Worker bundle file in multipart/form-data format. Mutually exclusive with `_worker.js`. Cannot specify both `_worker.js` and `_worker.bundle` in the same request. Maximum size: 25 MiB.
- name: _worker.js
value: "{{ _worker.js }}"
description: |
Worker JavaScript file. Mutually exclusive with `_worker.bundle`. Cannot specify both `_worker.js` and `_worker.bundle` in the same request.
- name: branch
value: "{{ branch }}"
description: |
The branch to build the new deployment from. The `HEAD` of the branch will be used. If omitted, the production branch will be used by default.
- name: commit_dirty
value: "{{ commit_dirty }}"
description: |
Boolean string indicating if the working directory has uncommitted changes.
valid_values: ['true', 'false']
- name: commit_hash
value: "{{ commit_hash }}"
description: |
Git commit SHA associated with this deployment.
- name: commit_message
value: "{{ commit_message }}"
description: |
Git commit message associated with this deployment.
- name: functions-filepath-routing-config.json
value: "{{ functions-filepath-routing-config.json }}"
description: |
Functions routing configuration file.
- name: manifest
value: "{{ manifest }}"
description: |
JSON string containing a manifest of files to deploy. Maps file paths to their content hashes. Required for direct upload deployments. Maximum 20,000 entries.
- name: pages_build_output_dir
value: "{{ pages_build_output_dir }}"
description: |
The build output directory path.
- name: wrangler_config_hash
value: "{{ wrangler_config_hash }}"
description: |
Hash of the Wrangler configuration file used for this deployment.
DELETE examples
- delete
Delete a deployment.
DELETE FROM cloudflare.pages.deployments
WHERE deployment_id = '{{ deployment_id }}' --required
AND project_name = '{{ project_name }}' --required
AND account_id = '{{ account_id }}' --required
AND force = '{{ force }}'
;
Lifecycle Methods
- retry
- rollback
Retry a previous deployment.
EXEC cloudflare.pages.deployments.retry
@deployment_id='{{ deployment_id }}' --required,
@project_name='{{ project_name }}' --required,
@account_id='{{ account_id }}' --required
;
Rollback the production deployment to a previous deployment. You can only rollback to succesful builds on production.
EXEC cloudflare.pages.deployments.rollback
@deployment_id='{{ deployment_id }}' --required,
@project_name='{{ project_name }}' --required,
@account_id='{{ account_id }}' --required
;