Skip to main content

builds

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

Overview

Namebuilds
TypeResource
Idnetlify.builds.builds

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstring
deploy_idstring
created_atstring (dateTime)
doneboolean
errorstring
shastring

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectsite_idpage, per_page
getselectbuild_id
createinsertsite_idbranch, clear_cache, image, template_id, titleRuns a build for a site. The build will be scheduled to run at the first opportunity, but it might not start immediately if insufficient account build capacity is available.<br /><br />Files for build can be uploaded as a zipped site using one of these methods:<br />1. Set Content-Type to 'application/zip' and send the zip file as the raw request body<br />2. Set Content-Type to 'multipart/form-data' and include the zip file in the 'zip' field<br />
update_logexecbuild_id
notify_startexecbuild_idbuildbot_version, build_version, task_id

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
build_idstring
site_idstring
branchstringIf no branch is specified, it is treated as a production deploy If a branch IS specified and matches the main branch, it is also production If a branch is specified and doesn't match the main branch, it is a branch deploy
build_versionstring
buildbot_versionstring
clear_cachebooleanWhether to clear the build cache before building
imagestringThe build image tag to use for the build
pageinteger (int32)
per_pageinteger (int32)
task_idstring
template_idstringThe build template to use for the build
titlestringThe title of the build

SELECT examples

OK

SELECT
id,
deploy_id,
created_at,
done,
error,
sha
FROM netlify.builds.builds
WHERE site_id = '{{ site_id }}' -- required
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
;

INSERT examples

Runs a build for a site. The build will be scheduled to run at the first opportunity, but it might not start immediately if insufficient account build capacity is available.<br /><br />Files for build can be uploaded as a zipped site using one of these methods:<br />1. Set Content-Type to 'application/zip' and send the zip file as the raw request body<br />2. Set Content-Type to 'multipart/form-data' and include the zip file in the 'zip' field<br />

INSERT INTO netlify.builds.builds (
zip,
site_id,
branch,
clear_cache,
image,
template_id,
title
)
SELECT
'{{ zip }}',
'{{ site_id }}',
'{{ branch }}',
'{{ clear_cache }}',
'{{ image }}',
'{{ template_id }}',
'{{ title }}'
RETURNING
id,
deploy_id,
created_at,
done,
error,
sha
;

Lifecycle Methods

No content

EXEC netlify.builds.builds.update_log
@build_id='{{ build_id }}' --required
;