Operate sandbox
Learn how to add and configure the "Operate sandbox" action in your Buddy pipeline
Start
POST参数
名称 | 类型 | 描述 |
---|---|---|
action 必填 | String | The ID of the action. |
type 必填 | String | The type of the action. Must be set to SANDBOX_START . |
sandbox_references 必填 | String | Defines the sandbox selection method. Available values: BY_TAGS , BY_NAME , BY_PROJECT , BY_DAYS , BY_ID , BY_ACTION . |
sandbox_id | String | ID of the sandbox to which the files are uploaded. Required when sandbox_references is set to BY_ID . |
referenced_action_id | Int | ID of the action that creates the target sandbox.Required when sandbox_references is set to BY_ACTION . |
referenced_sanbox_name | String | Name of the target sandbox. Required when sandbox_references is set to BY_NAME . |
tags | String[] | List of tags applied to the target sandbox. Required when sandbox_references is set to BY_TAGS . |
sandbox_project_id | Int | ID of the project with the target sandbox. Required when sandbox_references is set to BY_PROJECT . |
days | Int | Number of days passed since the creation of the target sandbox. One of 1 , 2 , 3 , 7 , 14 , 30 . Required when sandbox_references is set to BY_DAYS . |
Sample Request
POST https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2/actions
JSON
{
"name": "Start sandbox",
"type": "SANDBOX_START",
"sandbox_id": "BJ7YnoUVtfGdo",
"sandbox_references": [
"BY_ID"
]
"trigger_time": "ON_EVERY_EXECUTION"
}
示例响应
HTTP
Status: 201 Created
X-Rate-Limit-Limit: 1
X-Rate-Limit-Remaining: 999
JSON
{
"url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2/actions/1",
"html_url": "https://app.buddy.works/buddy/company-website/pipelines/action/1/edit",
"id": 1,
"name": "Start sandbox",
"type": "SANDBOX_START",
"trigger_time": "ON_EVERY_EXECUTION",
"sandbox_id": "BJ7YnoUVtfGdo",
"sandbox_references": [
"BY_ID"
]
"pipeline": {
"url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2",
"html_url": "https://app.buddy.works/buddy/company-website/pipelines/pipeline/2",
"id": 2,
"name": "Live mirror",
"on": "CLICK",
"refs": [
"refs/heads/master"
],
"last_execution_status": "SUCCESSFUL",
"last_execution_revision": "506a3963507943d6908154f4bc9646e829128a08"
}
}
Stop
POST参数
名称 | 类型 | 描述 |
---|---|---|
action 必填 | String | The ID of the action. |
type 必填 | String | The type of the action. Must be set to SANDBOX_STOP . |
sandbox_references 必填 | String | Defines the sandbox selection method. Available values: BY_TAGS , BY_NAME , BY_PROJECT , BY_DAYS , BY_ID , BY_ACTION . |
sandbox_id | String | ID of the sandbox to which the files are uploaded. Required when sandbox_references is set to BY_ID . |
referenced_action_id | Int | ID of the action that creates the target sandbox.Required when sandbox_references is set to BY_ACTION . |
referenced_sanbox_name | String | Name of the target sandbox. Required when sandbox_references is set to BY_NAME . |
tags | String[] | List of tags applied to the target sandbox. Required when sandbox_references is set to BY_TAGS . |
sandbox_project_id | Int | ID of the project with the target sandbox. Required when sandbox_references is set to BY_PROJECT . |
days | Int | Number of days passed since the creation of the target sandbox. One of 1 , 2 , 3 , 7 , 14 , 30 . Required when sandbox_references is set to BY_DAYS . |
Sample Request
POST https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2/actions
JSON
{
"name": "Stop sandbox",
"type": "SANDBOX_STOP",
"trigger_time": "ON_EVERY_EXECUTION",
"sandbox_id": "Cgn3QO34klUri",
"sandbox_references": [
"BY_ID"
]
}
示例响应
HTTP
Status: 201 Created
X-Rate-Limit-Limit: 1
X-Rate-Limit-Remaining: 999
JSON
{
"url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2/actions/1",
"html_url": "https://app.buddy.works/buddy/company-website/pipelines/action/1/edit",
"id": 1,
"name": "Stop sandbox",
"type": "SANDBOX_STOP",
"trigger_time": "ON_EVERY_EXECUTION",
"sandbox_id": "Cgn3QO34klUri",
"sandbox_references": [
"BY_ID"
]
"pipeline": {
"url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2",
"html_url": "https://app.buddy.works/buddy/company-website/pipelines/pipeline/2",
"id": 2,
"name": "Live mirror",
"on": "CLICK",
"refs": [
"refs/heads/master"
],
"last_execution_status": "SUCCESSFUL",
"last_execution_revision": "506a3963507943d6908154f4bc9646e829128a08"
}
}
Destroy sandbox
POST参数
名称 | 类型 | 描述 |
---|---|---|
action 必填 | String | The ID of the action. |
type 必填 | String | The type of the action. Must be set to SANDBOX_DELETE . |
sandbox_references 必填 | String | Defines the sandbox selection method. Available values: BY_TAGS , BY_NAME , BY_PROJECT , BY_DAYS , BY_ID , BY_ACTION . |
sandbox_id | String | ID of the sandbox to which the files are uploaded. Required when sandbox_references is set to BY_ID . |
referenced_action_id | Int | ID of the action that creates the target sandbox.Required when sandbox_references is set to BY_ACTION . |
referenced_sanbox_name | String | Name of the target sandbox. Required when sandbox_references is set to BY_NAME . |
tags | String[] | List of tags applied to the target sandbox. Required when sandbox_references is set to BY_TAGS . |
sandbox_project_id | Int | ID of the project with the target sandbox. Required when sandbox_references is set to BY_PROJECT . |
days | Int | Number of days passed since the creation of the target sandbox. One of 1 , 2 , 3 , 7 , 14 , 30 . Required when sandbox_references is set to BY_DAYS . |
Sample Request
POST https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2/actions
JSON
{
"name": "Destroy sandbox",
"type": "SANDBOX_DELETE",
"trigger_time": "ON_EVERY_EXECUTION",
"sandbox_id": "Cgn3QO34klUri",
"sandbox_references": [
"BY_ID"
]
}
示例响应
HTTP
Status: 201 Created
X-Rate-Limit-Limit: 1
X-Rate-Limit-Remaining: 999
JSON
{
"url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2/actions/2",
"html_url": "https://app.buddy.works/buddy/company-website/pipelines/action/2/edit",
"id": 2,
"name": "Destroy sandbox",
"type": "SANDBOX_DELETE",
"trigger_time": "ON_EVERY_EXECUTION",
"last_execution_status": "INITIAL",
"sandbox_references": [
"BY_ID"
],
"sandbox_id": "Cgn3QO34klUri",
"pipeline": {
"url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2",
"html_url": "https://app.buddy.works/buddy/company-website/pipelines/pipeline/2",
"id": 2,
"name": "Live mirror",
"refs": [
"refs/heads/master"
],
"last_execution_status": "SUCCESSFUL",
"last_execution_revision": "506a3963507943d6908154f4bc9646e829128a08"
}
}
Snapshot
POST参数
名称 | 类型 | 描述 |
---|---|---|
action 必填 | String | The ID of the action. |
type 必填 | String | The type of the action. Must be set to SANDBOX_SNAPSHOT . |
sandbox_references 必填 | String | Defines the sandbox selection method. Available values: BY_TAGS , BY_NAME , BY_PROJECT , BY_DAYS , BY_ID , BY_ACTION . |
sandbox_id | String | ID of the sandbox to which the files are uploaded. Required when sandbox_references is set to BY_ID . |
referenced_action_id | Int | ID of the action that creates the target sandbox.Required when sandbox_references is set to BY_ACTION . |
referenced_sanbox_name | String | Name of the target sandbox. Required when sandbox_references is set to BY_NAME . |
tags | String[] | List of tags applied to the target sandbox. Required when sandbox_references is set to BY_TAGS . |
sandbox_project_id | Int | ID of the project with the target sandbox. Required when sandbox_references is set to BY_PROJECT . |
days | Int | Number of days passed since the creation of the target sandbox. One of 1 , 2 , 3 , 7 , 14 , 30 . Required when sandbox_references is set to BY_DAYS . |
snapshot_name 必填 | String | Defines the name of the created snapshot. |
Sample Request
POST https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2/actions
JSON
"name": "Create snapshot",
"type": "SANDBOX_SNAPSHOT",
"trigger_time": "ON_EVERY_EXECUTION",
"sandbox_id": "Cgn3QO34klUri",
"sandbox_references": [
"BY_ID"
]
"snapshot_name": "snapshot-$BUDDY_EXECUTION_ID"
}
示例响应
HTTP
Status: 201 Created
X-Rate-Limit-Limit: 1
X-Rate-Limit-Remaining: 999
JSON
{
"url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2/actions/1",
"html_url": "https://app.buddy.works/buddy/company-website/pipelines/action/1/edit",
"id": 1,
"name": "Create snapshott",
"type": "SANDBOX_SNAPSHOT",
"trigger_time": "ON_EVERY_EXECUTION",
"sandbox_id": "Cgn3QO34klUri",
"sandbox_references": [
"BY_ID"
]
"snapshot_name": "snapshot-$BUDDY_EXECUTION_ID",
"pipeline": {
"url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2",
"html_url": "https://app.buddy.works/buddy/company-website/pipelines/pipeline/2",
"id": 2,
"name": "Live mirror",
"on": "CLICK",
"refs": [
"refs/heads/master"
],
"last_execution_status": "SUCCESSFUL",
"last_execution_revision": "506a3963507943d6908154f4bc9646e829128a08"
}
}