CreatePrebuild
POST/gitpod.v1.PrebuildService/CreatePrebuild
Creates a prebuild for a project.
Use this method to:
- Create on-demand prebuilds for faster environment startup
- Trigger prebuilds after repository changes
- Generate prebuilds for specific environment classes
The prebuild process creates an environment, runs the devcontainer prebuild lifecycle, and creates a snapshot for future environment provisioning.
Examples
-
Create basic prebuild:
Creates a prebuild for a project using default settings.
projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" spec: timeout: "3600s" # 60 minutes default -
Create prebuild with custom environment class:
Creates a prebuild with a specific environment class and timeout.
projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" spec: timeout: "3600s" # 1 hour
CreatePrebuild
curl https://app.gitpod.io/api/gitpod.v1.PrebuildService/CreatePrebuild \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $GITPOD_API_KEY" \
-d '{
"projectId": "b0e12f6c-4c67-429d-a4a6-d9838b5da047",
"spec": {
"timeout": "3600s"
}
}'{
"prebuild": {
"metadata": {
"createdAt": "2019-12-27T18:11:19.117Z",
"creator": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
},
"updatedAt": "2019-12-27T18:11:19.117Z",
"environmentClassId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"executor": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
},
"organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"projectId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"triggeredBy": "PREBUILD_TRIGGER_UNSPECIFIED"
},
"spec": {
"desiredPhase": "PREBUILD_PHASE_UNSPECIFIED",
"specVersion": "specVersion",
"timeout": "+9125115.360s"
},
"status": {
"phase": "PREBUILD_PHASE_UNSPECIFIED",
"completionTime": "2019-12-27T18:11:19.117Z",
"environmentId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"failureMessage": "failureMessage",
"logUrl": "https://example.com",
"snapshotCompletionPercentage": 100,
"snapshotSizeBytes": "snapshotSizeBytes",
"statusVersion": "statusVersion",
"warningMessage": "warningMessage"
},
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
}Returns Examples
{
"prebuild": {
"metadata": {
"createdAt": "2019-12-27T18:11:19.117Z",
"creator": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
},
"updatedAt": "2019-12-27T18:11:19.117Z",
"environmentClassId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"executor": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
},
"organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"projectId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"triggeredBy": "PREBUILD_TRIGGER_UNSPECIFIED"
},
"spec": {
"desiredPhase": "PREBUILD_PHASE_UNSPECIFIED",
"specVersion": "specVersion",
"timeout": "+9125115.360s"
},
"status": {
"phase": "PREBUILD_PHASE_UNSPECIFIED",
"completionTime": "2019-12-27T18:11:19.117Z",
"environmentId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"failureMessage": "failureMessage",
"logUrl": "https://example.com",
"snapshotCompletionPercentage": 100,
"snapshotSizeBytes": "snapshotSizeBytes",
"statusVersion": "statusVersion",
"warningMessage": "warningMessage"
},
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
}