跳到主要内容

SSH to sandbox

Learn how to add and configure the \"SSH to sandbox\" action in your Buddy pipeline

POST参数

名称类型描述
action
必填
StringThe ID of the action.
type
必填
StringThe type of the action. Must be set to SANDBOX_EXEC.
working_directoryStringThe absolute or relative path on the sandbox.
userStringThe name of the local (to the sandbox server) user who uploads the files.
commands
必填
String[]The array of commands invoked on the sandbox.
shellStringThe name of the shell used to execute commands. Can be one of BASH (default) or SH.
sandbox_references 必填StringDefines the sandbox selection method. Available values: BY_TAGS, BY_NAME, BY_PROJECT, BY_DAYS, BY_ID, BY_ACTION.
sandbox_idStringID of the sandbox to which the files are uploaded. Required when sandbox_references is set to BY_ID.
referenced_action_idIntID of the action that creates the target sandbox.Required when sandbox_references is set to BY_ACTION.
referenced_sanbox_nameStringName of the target sandbox. Required when sandbox_references is set to BY_NAME.
tagsString[]List of tags applied to the target sandbox. Required when sandbox_references is set to BY_TAGS.
sandbox_project_idIntID of the project with the target sandbox. Required when sandbox_references is set to BY_PROJECT.
daysIntNumber 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.
execute_every_commandBooleanIf set to true all commands will be executed regardless of the result of the previous command.

Sample Request

POST https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2/actions

JSON

{
"name": "Execute command in sandbox",
"type": "SANDBOX_EXEC",
"trigger_time": "ON_EVERY_EXECUTION",
"user": "ubuntu",
"working_directory": "/root",
"shell": "BASH",
"sandbox_id": "Cgn3QO34klUri",
"sandbox_references": [
"BY_ID"
]
"execute_every_command": true
"commands": [
"ls"
]
}

示例响应

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": "Execute command in sandbox",
"type": "SANDBOX_EXEC",
"trigger_time": "ON_EVERY_EXECUTION",
"last_execution_status": "INITIAL",
"user": "ubuntu",
"working_directory": "/root",
"shell": "BASH",
"sandbox_id": "Cgn3QO34klUri",
"sandbox_references": [
"BY_ID"
]
"execute_every_command": true
"commands": [
"ls"
],
"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"
}
}