Skip to main content

deployments

Creates, updates, deletes, gets or lists a deployments resource.

Overview

Namedeployments
TypeResource
Idcloudflare.pages.deployments

Fields

The following fields are returned by SELECT queries:

Get deployment info response.

NameDatatypeDescription
idstringId of the deployment. (example: f64788e9-fccd-4d4a-a28a-cb84f88f6)
project_idstringId of the project. (example: 7b162ea7-7367-4d67-bcde-1160995d5)
short_idstringShort Id (8 character) of the deployment. (example: f64788e9)
project_namestringName of the project. (example: this-is-my-project-01)
aliasesarrayA list of alias URLs pointing to this deployment.
build_configobjectConfigs for the project build process.
created_onstring (date-time)When the deployment was created. (example: 2021-03-09T00:55:03.923456Z)
deployment_triggerobjectInfo about what caused the deployment.
env_varsobjectEnvironment variables used for builds and Pages Functions.
environmentstringType of deploy. (preview, production) (example: preview)
is_skippedbooleanIf the deployment has been skipped.
latest_stageobjectThe status of the deployment.
modified_onstring (date-time)When the deployment was last modified. (example: 2021-03-09T00:58:59.045655Z)
sourceobjectConfigs for the project source control.
stagesarrayList of past stages.
urlstringThe live URL to view this deployment. (example: https://f64788e9.ninjakittens.pages.dev)
uses_functionsbooleanWhether the deployment uses functions.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectdeployment_id, project_name, account_idFetch information about a deployment.
listselectproject_name, account_idenv, page, per_pageFetch a list of project deployments.
createinsertproject_name, account_idStart a new deployment from production. The repository and account must have already been authorized on the Cloudflare Pages dashboard.
deletedeletedeployment_id, project_name, account_idforceDelete a deployment.
retryexecdeployment_id, project_name, account_idRetry a previous deployment.
rollbackexecdeployment_id, project_name, account_idRollback 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.

NameDatatypeDescription
account_idstringThe Cloudflare account ID.
deployment_idstring
project_namestringThe Pages project name.
envstring
forceboolean
pageinteger
per_pageinteger

SELECT examples

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
;

INSERT examples

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
;

DELETE examples

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 a previous deployment.

EXEC cloudflare.pages.deployments.retry
@deployment_id='{{ deployment_id }}' --required,
@project_name='{{ project_name }}' --required,
@account_id='{{ account_id }}' --required
;