CreateEnvironmentFromProject
POST/gitpod.v1.EnvironmentService/CreateEnvironmentFromProject
Creates an environment from an existing project configuration and starts it.
This method uses project settings as defaults but allows overriding specific configurations. Project settings take precedence over default configurations, while custom specifications in the request override project settings.
Examples
-
Create with project defaults:
Creates an environment using all default settings from the project configuration.
projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" -
Create with custom compute resources:
Creates an environment from project with custom machine class and timeout settings.
projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" spec: machine: class: "d2c94c27-3b76-4a42-b88c-95a85e392c68" timeout: disconnected: "14400s" # 4 hours in seconds
Body ParametersJSON
CreateEnvironmentFromProject
curl https://app.gitpod.io/api/gitpod.v1.EnvironmentService/CreateEnvironmentFromProject \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $GITPOD_API_KEY" \
-d '{}'{
"environment": {
"id": "id",
"metadata": {
"annotations": {
"foo": "string"
},
"archivedAt": "2019-12-27T18:11:19.117Z",
"createdAt": "2019-12-27T18:11:19.117Z",
"creator": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
},
"lastStartedAt": "2019-12-27T18:11:19.117Z",
"lockdownAt": "2019-12-27T18:11:19.117Z",
"name": "name",
"organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"originalContextUrl": "originalContextUrl",
"prebuildId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"projectId": "projectId",
"role": "ENVIRONMENT_ROLE_UNSPECIFIED",
"runnerId": "runnerId",
"sessionId": "sessionId"
},
"spec": {
"admission": "ADMISSION_LEVEL_UNSPECIFIED",
"automationsFile": {
"automationsFilePath": "automationsFilePath",
"session": "session",
"triggerFilter": [
{
"beforeSnapshot": true,
"manual": true,
"postDevcontainerStart": true,
"postEnvironmentStart": true,
"postMachineStart": true,
"prebuild": true
}
]
},
"content": {
"gitEmail": "gitEmail",
"gitUsername": "gitUsername",
"initializer": {
"specs": [
{
"contextUrl": {
"url": "https://example.com"
},
"git": {
"checkoutLocation": "checkoutLocation",
"cloneTarget": "cloneTarget",
"remoteUri": "remoteUri",
"targetMode": "CLONE_TARGET_MODE_UNSPECIFIED",
"upstreamRemoteUri": "upstreamRemoteUri"
}
}
]
},
"session": "session"
},
"desiredPhase": "ENVIRONMENT_PHASE_UNSPECIFIED",
"devcontainer": {
"defaultDevcontainerImage": "defaultDevcontainerImage",
"devcontainerFilePath": "devcontainerFilePath",
"dotfiles": {
"repository": "https://example.com"
},
"lifecycleStage": "LIFECYCLE_STAGE_UNSPECIFIED",
"session": "session"
},
"kernelControlsConfig": {
"bpfDebugLevel": "BPF_DEBUG_LEVEL_UNSPECIFIED",
"veto": {
"exec": {
"action": "KERNEL_CONTROLS_ACTION_UNSPECIFIED",
"denyBlockDevices": true,
"denylist": [
"string"
],
"enabled": true,
"resolveBareNames": true,
"untouchable": true,
"watch": true
}
}
},
"machine": {
"class": "class",
"preferDualDisk": true,
"session": "session"
},
"ports": [
{
"admission": "ADMISSION_LEVEL_UNSPECIFIED",
"authNonce": "authNonce",
"name": "x",
"port": 1024,
"protocol": "PROTOCOL_UNSPECIFIED"
}
],
"secrets": [
{
"id": "id",
"apiOnly": true,
"containerRegistryBasicAuthHost": "containerRegistryBasicAuthHost",
"credentialProxy": {
"format": "FORMAT_UNSPECIFIED",
"header": "header",
"targetHosts": [
"string"
]
},
"environmentVariable": "environmentVariable",
"filePath": "filePath",
"gitCredentialHost": "gitCredentialHost",
"name": "name",
"scope": "SCOPE_UNSPECIFIED",
"session": "session",
"source": "source",
"sourceRef": "sourceRef"
}
],
"specVersion": "specVersion",
"sshPublicKeys": [
{
"id": "id",
"value": "value"
}
],
"timeout": {
"disconnected": "+9125115.360s"
},
"workflowActionId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
},
"status": {
"activitySignal": {
"source": "xxx",
"timestamp": "2019-12-27T18:11:19.117Z"
},
"automationsFile": {
"automationsFilePath": "automationsFilePath",
"automationsFilePresence": "PRESENCE_UNSPECIFIED",
"failureMessage": "failureMessage",
"phase": "CONTENT_PHASE_UNSPECIFIED",
"session": "session",
"warningMessage": "warningMessage"
},
"content": {
"contentLocationInMachine": "contentLocationInMachine",
"failureMessage": "failureMessage",
"git": {
"branch": "branch",
"changedFiles": [
{
"changeType": "CHANGE_TYPE_UNSPECIFIED",
"oldPath": "oldPath",
"path": "path"
}
],
"cloneUrl": "cloneUrl",
"latestCommit": "latestCommit",
"totalChangedFiles": 0,
"totalUnpushedCommits": 0,
"unpushedCommits": [
"string"
]
},
"phase": "CONTENT_PHASE_UNSPECIFIED",
"session": "session",
"warningMessage": "warningMessage"
},
"devcontainer": {
"containerId": "containerId",
"containerName": "containerName",
"devcontainerconfigInSync": true,
"devcontainerFilePath": "devcontainerFilePath",
"devcontainerFilePresence": "PRESENCE_UNSPECIFIED",
"failureMessage": "failureMessage",
"phase": "PHASE_UNSPECIFIED",
"remoteUser": "remoteUser",
"remoteWorkspaceFolder": "remoteWorkspaceFolder",
"secretsInSync": true,
"session": "session",
"warningMessage": "warningMessage"
},
"environmentUrls": {
"logs": "logs",
"ops": "ops",
"ports": [
{
"port": 1024,
"url": "url"
}
],
"ssh": {
"url": "url"
},
"supportBundle": "supportBundle",
"vmLiveUsage": "vmLiveUsage"
},
"failureMessage": [
"string"
],
"machine": {
"dualDisk": true,
"failureMessage": "failureMessage",
"phase": "PHASE_UNSPECIFIED",
"session": "session",
"timeout": "timeout",
"versions": {
"amiId": "amiId",
"supervisorCommit": "supervisorCommit",
"supervisorVersion": "supervisorVersion"
},
"warningMessage": "warningMessage"
},
"phase": "ENVIRONMENT_PHASE_UNSPECIFIED",
"runnerAck": {
"message": "message",
"specVersion": "specVersion",
"statusCode": "STATUS_CODE_UNSPECIFIED"
},
"secrets": [
{
"id": "id",
"failureMessage": "failureMessage",
"phase": "CONTENT_PHASE_UNSPECIFIED",
"secretName": "secretName",
"session": "session",
"warningMessage": "warningMessage"
}
],
"sshPublicKeys": [
{
"id": "id",
"phase": "CONTENT_PHASE_UNSPECIFIED"
}
],
"statusVersion": "statusVersion",
"warningMessage": [
"string"
]
}
}
}Returns Examples
{
"environment": {
"id": "id",
"metadata": {
"annotations": {
"foo": "string"
},
"archivedAt": "2019-12-27T18:11:19.117Z",
"createdAt": "2019-12-27T18:11:19.117Z",
"creator": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
},
"lastStartedAt": "2019-12-27T18:11:19.117Z",
"lockdownAt": "2019-12-27T18:11:19.117Z",
"name": "name",
"organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"originalContextUrl": "originalContextUrl",
"prebuildId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"projectId": "projectId",
"role": "ENVIRONMENT_ROLE_UNSPECIFIED",
"runnerId": "runnerId",
"sessionId": "sessionId"
},
"spec": {
"admission": "ADMISSION_LEVEL_UNSPECIFIED",
"automationsFile": {
"automationsFilePath": "automationsFilePath",
"session": "session",
"triggerFilter": [
{
"beforeSnapshot": true,
"manual": true,
"postDevcontainerStart": true,
"postEnvironmentStart": true,
"postMachineStart": true,
"prebuild": true
}
]
},
"content": {
"gitEmail": "gitEmail",
"gitUsername": "gitUsername",
"initializer": {
"specs": [
{
"contextUrl": {
"url": "https://example.com"
},
"git": {
"checkoutLocation": "checkoutLocation",
"cloneTarget": "cloneTarget",
"remoteUri": "remoteUri",
"targetMode": "CLONE_TARGET_MODE_UNSPECIFIED",
"upstreamRemoteUri": "upstreamRemoteUri"
}
}
]
},
"session": "session"
},
"desiredPhase": "ENVIRONMENT_PHASE_UNSPECIFIED",
"devcontainer": {
"defaultDevcontainerImage": "defaultDevcontainerImage",
"devcontainerFilePath": "devcontainerFilePath",
"dotfiles": {
"repository": "https://example.com"
},
"lifecycleStage": "LIFECYCLE_STAGE_UNSPECIFIED",
"session": "session"
},
"kernelControlsConfig": {
"bpfDebugLevel": "BPF_DEBUG_LEVEL_UNSPECIFIED",
"veto": {
"exec": {
"action": "KERNEL_CONTROLS_ACTION_UNSPECIFIED",
"denyBlockDevices": true,
"denylist": [
"string"
],
"enabled": true,
"resolveBareNames": true,
"untouchable": true,
"watch": true
}
}
},
"machine": {
"class": "class",
"preferDualDisk": true,
"session": "session"
},
"ports": [
{
"admission": "ADMISSION_LEVEL_UNSPECIFIED",
"authNonce": "authNonce",
"name": "x",
"port": 1024,
"protocol": "PROTOCOL_UNSPECIFIED"
}
],
"secrets": [
{
"id": "id",
"apiOnly": true,
"containerRegistryBasicAuthHost": "containerRegistryBasicAuthHost",
"credentialProxy": {
"format": "FORMAT_UNSPECIFIED",
"header": "header",
"targetHosts": [
"string"
]
},
"environmentVariable": "environmentVariable",
"filePath": "filePath",
"gitCredentialHost": "gitCredentialHost",
"name": "name",
"scope": "SCOPE_UNSPECIFIED",
"session": "session",
"source": "source",
"sourceRef": "sourceRef"
}
],
"specVersion": "specVersion",
"sshPublicKeys": [
{
"id": "id",
"value": "value"
}
],
"timeout": {
"disconnected": "+9125115.360s"
},
"workflowActionId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
},
"status": {
"activitySignal": {
"source": "xxx",
"timestamp": "2019-12-27T18:11:19.117Z"
},
"automationsFile": {
"automationsFilePath": "automationsFilePath",
"automationsFilePresence": "PRESENCE_UNSPECIFIED",
"failureMessage": "failureMessage",
"phase": "CONTENT_PHASE_UNSPECIFIED",
"session": "session",
"warningMessage": "warningMessage"
},
"content": {
"contentLocationInMachine": "contentLocationInMachine",
"failureMessage": "failureMessage",
"git": {
"branch": "branch",
"changedFiles": [
{
"changeType": "CHANGE_TYPE_UNSPECIFIED",
"oldPath": "oldPath",
"path": "path"
}
],
"cloneUrl": "cloneUrl",
"latestCommit": "latestCommit",
"totalChangedFiles": 0,
"totalUnpushedCommits": 0,
"unpushedCommits": [
"string"
]
},
"phase": "CONTENT_PHASE_UNSPECIFIED",
"session": "session",
"warningMessage": "warningMessage"
},
"devcontainer": {
"containerId": "containerId",
"containerName": "containerName",
"devcontainerconfigInSync": true,
"devcontainerFilePath": "devcontainerFilePath",
"devcontainerFilePresence": "PRESENCE_UNSPECIFIED",
"failureMessage": "failureMessage",
"phase": "PHASE_UNSPECIFIED",
"remoteUser": "remoteUser",
"remoteWorkspaceFolder": "remoteWorkspaceFolder",
"secretsInSync": true,
"session": "session",
"warningMessage": "warningMessage"
},
"environmentUrls": {
"logs": "logs",
"ops": "ops",
"ports": [
{
"port": 1024,
"url": "url"
}
],
"ssh": {
"url": "url"
},
"supportBundle": "supportBundle",
"vmLiveUsage": "vmLiveUsage"
},
"failureMessage": [
"string"
],
"machine": {
"dualDisk": true,
"failureMessage": "failureMessage",
"phase": "PHASE_UNSPECIFIED",
"session": "session",
"timeout": "timeout",
"versions": {
"amiId": "amiId",
"supervisorCommit": "supervisorCommit",
"supervisorVersion": "supervisorVersion"
},
"warningMessage": "warningMessage"
},
"phase": "ENVIRONMENT_PHASE_UNSPECIFIED",
"runnerAck": {
"message": "message",
"specVersion": "specVersion",
"statusCode": "STATUS_CODE_UNSPECIFIED"
},
"secrets": [
{
"id": "id",
"failureMessage": "failureMessage",
"phase": "CONTENT_PHASE_UNSPECIFIED",
"secretName": "secretName",
"session": "session",
"warningMessage": "warningMessage"
}
],
"sshPublicKeys": [
{
"id": "id",
"phase": "CONTENT_PHASE_UNSPECIFIED"
}
],
"statusVersion": "statusVersion",
"warningMessage": [
"string"
]
}
}
}