跳到主要内容

运行

流水线API

执行流水线运行

要求权限范围: WORKSPACE, EXECUTION_RUN

资源URL

POST /workspaces/:domain/projects/:project_name/pipelines/:pipeline_id/executions

URL参数

名称类型描述
domain
必填
String工作区域名
pipeline_id
必填
Integer所需方案的数字ID
project_name
必填
String项目名称ID

POST参数

名称类型描述
to_revision
必填
Object包含修订字段的对象,其中将从将在流水线中执行的存储仓提供修订或HEAD。
variablesVariable[]要设置为流水线参数的变量列表
branchObject当流水线有多个引用或其中一个引用是通配符时,包含名称字段的对象具有要执行的分支名称。
tagString当流水线有多个引用或其中一个引用是通配符时,要执行的标签名称。
commentString执行的注解
refreshBoolean从头开始部署
clear_cacheBoolean运行流水线之前清除缓存
priorityString执行优先级,可设置LOWNORMAL或者HIGH,默认为NORMAL
actions_to_runInteger[]发送要在此执行中运行的操作ID列表。 如果没发送,将按流水线定义运行。
pull_requestObject包含名称字段的对象,该字段当流水线具有多个引用或其中一个引用是通配符时要执行拉取请求的名称。

示例

请求

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

JSON

{
"to_revision": {
"revision": "HEAD"
},
"comment": "hotfix",
"clear_cache": true,
"priority": "HIGH",
"variables": [
{
"key": "version",
"value": "1.0"
},
{
"key": "pass",
"value": "qwerty",
"encrypted": true
}
],
"actions_to_run": [
1,
2
]
}

请求

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

JSON

{
"branch": {
"name": "master"
},
"comment": "hotfix"
}

请求

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

JSON

{
"tag": {
"name": "v1.0"
},
"comment": "hotfix"
}

示例响应

HTTP

Status: 200 OK
X-Rate-Limit-Limit: 1
X-Rate-Limit-Remaining: 999

JSON

{
"url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2/executions/3",
"html_url": "https://app.buddy.works/buddy/company-website/pipelines/pipeline/2/execution/56fa37f499f1e10c105fb388",
"id": 3,
"start_date": "2016-03-29T08:08:20.205Z",
"finish_date": null,
"priority": "HIGH",
"triggeredOn": "CLICK",
"refresh": false,
"status": "INPROGRESS",
"comment": "hotfix",
"branch": {
"url": "https://api.buddy.works/workspaces/buddy/projects/company-website/repository/branches/master",
"html_url": "https://app.buddy.works/buddy/company-website/repository/branch/master",
"name": "master",
"default": true
},
"from_revision": {
"url": "https://api.buddy.works/workspaces/buddy/projects/company-website/repository/commits/506a3963507943d6908154f4bc9646e829128a08",
"html_url": "https://app.buddy.works/buddy/company-website/repository/commit/506a3963507943d6908154f4bc9646e829128a08",
"revision": "506a3963507943d6908154f4bc9646e829128a08",
"author_date": "2016-01-19T12:36:33Z",
"commit_date": "2016-01-19T12:36:33Z",
"message": "init repo\n",
"committer": {
"url": "https://api.buddy.works/workspaces/buddy/member/1",
"html_url": "https://app.buddy.works/buddy/profile/1",
"id": 1,
"name": "Mike Benson",
"avatar_url": "https://app.buddy.works/image-server/user/0/0/0/0/0/0/1/d643744fbe5ebf2906a4d075a5b97110/w/32/32/AVATAR.png"
},
"author": {
"url": "https://api.buddy.works/workspaces/buddy/member/1",
"html_url": "https://app.buddy.works/buddy/profile/1",
"id": 1,
"name": "Mike Benson",
"avatar_url": "https://app.buddy.works/image-server/user/0/0/0/0/0/0/1/d643744fbe5ebf2906a4d075a5b97110/w/32/32/AVATAR.png"
}
},
"to_revision": {
"url": "https://api.buddy.works/workspaces/buddy/projects/company-website/repository/commits/506a3963507943d6908154f4bc9646e829128a08",
"html_url": "https://app.buddy.works/buddy/company-website/repository/commit/506a3963507943d6908154f4bc9646e829128a08",
"revision": "506a3963507943d6908154f4bc9646e829128a08",
"author_date": "2016-01-19T12:36:33Z",
"commit_date": "2016-01-19T12:36:33Z",
"message": "init repo\n",
"committer": {
"url": "https://api.buddy.works/workspaces/buddy/member/1",
"html_url": "https://app.buddy.works/buddy/profile/1",
"id": 1,
"name": "Mike Benson",
"avatar_url": "https://app.buddy.works/image-server/user/0/0/0/0/0/0/1/d643744fbe5ebf2906a4d075a5b97110/w/32/32/AVATAR.png"
},
"author": {
"url": "https://api.buddy.works/workspaces/buddy/member/1",
"html_url": "https://app.buddy.works/buddy/profile/1",
"id": 1,
"name": "Mike Benson",
"avatar_url": "https://app.buddy.works/image-server/user/0/0/0/0/0/0/1/d643744fbe5ebf2906a4d075a5b97110/w/32/32/AVATAR.png"
}
},
"creator": {
"url": "https://api.buddy.works/workspaces/buddy/member/1",
"html_url": "https://app.buddy.works/buddy/profile/1",
"id": 1,
"name": "Mike Benson",
"avatar_url": "https://app.buddy.works/image-server/user/0/0/0/0/0/0/1/d643744fbe5ebf2906a4d075a5b97110/w/32/32/AVATAR.png"
},
"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": "dev",
"on": "CLICK",
"refs": [
"refs/heads/master"
],
"last_execution_status": "INPROGRESS",
"last_execution_revision": "506a3963507943d6908154f4bc9646e829128a08"
},
"action_executions": [
{
"status": "INPROGRESS",
"progress": 0.0,
"action": {
"url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2/actions/5",
"html_url": "https://app.buddy.works/buddy/company-website/pipelines/action/5/edit",
"id": 5,
"name": "Upload files to dev",
"type": "FTP",
"trigger_time": "ON_EVERY_EXECUTION",
"last_execution_status": "INPROGRESS"
}
}
]
}

本页编辑更新日期:2023/07/12