Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
182e2814
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
182e2814
编写于
8月 16, 2016
作者:
Z
Z.J. van de Weg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Docs for API endpoints
上级
39c71a19
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
431 addition
and
0 deletion
+431
-0
doc/api/builds.md
doc/api/builds.md
+46
-0
doc/api/deployments.md
doc/api/deployments.md
+384
-0
spec/requests/api/deployments_spec.rb
spec/requests/api/deployments_spec.rb
+1
-0
未找到文件。
doc/api/builds.md
浏览文件 @
182e2814
...
...
@@ -532,3 +532,49 @@ Example response:
"user"
:
null
}
```
## Play a build
Triggers a manual action to start a build.
```
POST /projects/:id/builds/:build_id/play
```
| Attribute | Type | Required | Description |
|------------|---------|----------|---------------------|
|
`id`
| integer | yes | The ID of a project |
|
`build_id`
| integer | yes | The ID of a build |
```
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/builds/1/play"
```
Example of response
```
json
{
"commit"
:
{
"author_email"
:
"admin@example.com"
,
"author_name"
:
"Administrator"
,
"created_at"
:
"2015-12-24T16:51:14.000+01:00"
,
"id"
:
"0ff3ae198f8601a285adcf5c0fff204ee6fba5fd"
,
"message"
:
"Test the CI integration."
,
"short_id"
:
"0ff3ae19"
,
"title"
:
"Test the CI integration."
},
"coverage"
:
null
,
"created_at"
:
"2016-01-11T10:13:33.506Z"
,
"artifacts_file"
:
null
,
"finished_at"
:
null
,
"id"
:
69
,
"name"
:
"rubocop"
,
"ref"
:
"master"
,
"runner"
:
null
,
"stage"
:
"test"
,
"started_at"
:
null
,
"status"
:
"started"
,
"tag"
:
false
,
"user"
:
null
}
```
doc/api/deployments.md
0 → 100644
浏览文件 @
182e2814
# Deployments API
## List project deployments
Get a list of deployments in a project.
```
GET /projects/:id/deployments
```
| Attribute | Type | Required | Description |
|-----------|---------|----------|---------------------|
|
`id`
| integer | yes | The ID of a project |
```
bash
curl
--header
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
"https://gitlab.example.com/api/v3/projects/1/deployments"
```
Example of response
```
json
[
{
"created_at"
:
"2016-08-11T07:36:40.222Z"
,
"deployable"
:
{
"commit"
:
{
"author_email"
:
"admin@example.com"
,
"author_name"
:
"Administrator"
,
"created_at"
:
"2016-08-11T09:36:01.000+02:00"
,
"id"
:
"99d03678b90d914dbb1b109132516d71a4a03ea8"
,
"message"
:
"Merge branch 'new-title' into 'master'
\r\n\r\n
Update README
\r\n\r\n\r\n\r\n
See merge request !1"
,
"short_id"
:
"99d03678"
,
"title"
:
"Merge branch 'new-title' into 'master'
\r
"
},
"coverage"
:
null
,
"created_at"
:
"2016-08-11T07:36:27.357Z"
,
"finished_at"
:
"2016-08-11T07:36:39.851Z"
,
"id"
:
657
,
"name"
:
"deploy"
,
"ref"
:
"master"
,
"runner"
:
null
,
"stage"
:
"deploy"
,
"started_at"
:
null
,
"status"
:
"success"
,
"tag"
:
false
,
"user"
:
{
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon"
,
"bio"
:
null
,
"created_at"
:
"2016-08-11T07:09:20.351Z"
,
"id"
:
1
,
"is_admin"
:
true
,
"linkedin"
:
""
,
"location"
:
null
,
"name"
:
"Administrator"
,
"skype"
:
""
,
"state"
:
"active"
,
"twitter"
:
""
,
"username"
:
"root"
,
"web_url"
:
"http://localhost:3000/u/root"
,
"website_url"
:
""
}
},
"environment"
:
{
"external_url"
:
"https://about.gitlab.com"
,
"id"
:
9
,
"name"
:
"production"
},
"id"
:
41
,
"iid"
:
1
,
"project"
:
{
"archived"
:
false
,
"avatar_url"
:
null
,
"builds_enabled"
:
true
,
"container_registry_enabled"
:
true
,
"created_at"
:
"2016-08-11T07:31:46.777Z"
,
"creator_id"
:
1
,
"default_branch"
:
"master"
,
"description"
:
""
,
"forks_count"
:
0
,
"http_url_to_repo"
:
"http://localhost:3000/root/ci-project.git"
,
"id"
:
9
,
"issues_enabled"
:
true
,
"last_activity_at"
:
"2016-08-11T11:32:53.239Z"
,
"merge_requests_enabled"
:
true
,
"name"
:
"ci-project"
,
"name_with_namespace"
:
"Administrator / ci-project"
,
"namespace"
:
{
"avatar"
:
null
,
"created_at"
:
"2016-08-11T07:09:20.585Z"
,
"deleted_at"
:
null
,
"description"
:
""
,
"id"
:
1
,
"name"
:
"root"
,
"owner_id"
:
1
,
"path"
:
"root"
,
"request_access_enabled"
:
true
,
"share_with_group_lock"
:
false
,
"updated_at"
:
"2016-08-11T07:09:20.585Z"
,
"visibility_level"
:
20
},
"open_issues_count"
:
0
,
"owner"
:
{
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon"
,
"id"
:
1
,
"name"
:
"Administrator"
,
"state"
:
"active"
,
"username"
:
"root"
,
"web_url"
:
"http://localhost:3000/u/root"
},
"path"
:
"ci-project"
,
"path_with_namespace"
:
"root/ci-project"
,
"public"
:
false
,
"public_builds"
:
true
,
"shared_runners_enabled"
:
true
,
"shared_with_groups"
:
[
],
"snippets_enabled"
:
false
,
"ssh_url_to_repo"
:
"ssh://zegerjan@localhost:2222/root/ci-project.git"
,
"star_count"
:
0
,
"tag_list"
:
[
],
"visibility_level"
:
0
,
"web_url"
:
"http://localhost:3000/root/ci-project"
,
"wiki_enabled"
:
true
},
"ref"
:
"master"
,
"sha"
:
"99d03678b90d914dbb1b109132516d71a4a03ea8"
,
"user"
:
{
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon"
,
"id"
:
1
,
"name"
:
"Administrator"
,
"state"
:
"active"
,
"username"
:
"root"
,
"web_url"
:
"http://localhost:3000/u/root"
}
},
{
"created_at"
:
"2016-08-11T11:32:35.444Z"
,
"deployable"
:
{
"commit"
:
{
"author_email"
:
"admin@example.com"
,
"author_name"
:
"Administrator"
,
"created_at"
:
"2016-08-11T13:28:26.000+02:00"
,
"id"
:
"a91957a858320c0e17f3a0eca7cfacbff50ea29a"
,
"message"
:
"Merge branch 'rename-readme' into 'master'
\r\n\r\n
Rename README
\r\n\r\n\r\n\r\n
See merge request !2"
,
"short_id"
:
"a91957a8"
,
"title"
:
"Merge branch 'rename-readme' into 'master'
\r
"
},
"coverage"
:
null
,
"created_at"
:
"2016-08-11T11:32:24.456Z"
,
"finished_at"
:
"2016-08-11T11:32:35.145Z"
,
"id"
:
664
,
"name"
:
"deploy"
,
"ref"
:
"master"
,
"runner"
:
null
,
"stage"
:
"deploy"
,
"started_at"
:
null
,
"status"
:
"success"
,
"tag"
:
false
,
"user"
:
{
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon"
,
"bio"
:
null
,
"created_at"
:
"2016-08-11T07:09:20.351Z"
,
"id"
:
1
,
"is_admin"
:
true
,
"linkedin"
:
""
,
"location"
:
null
,
"name"
:
"Administrator"
,
"skype"
:
""
,
"state"
:
"active"
,
"twitter"
:
""
,
"username"
:
"root"
,
"web_url"
:
"http://localhost:3000/u/root"
,
"website_url"
:
""
}
},
"environment"
:
{
"external_url"
:
"https://about.gitlab.com"
,
"id"
:
9
,
"name"
:
"production"
},
"id"
:
42
,
"iid"
:
2
,
"project"
:
{
"archived"
:
false
,
"avatar_url"
:
null
,
"builds_enabled"
:
true
,
"container_registry_enabled"
:
true
,
"created_at"
:
"2016-08-11T07:31:46.777Z"
,
"creator_id"
:
1
,
"default_branch"
:
"master"
,
"description"
:
""
,
"forks_count"
:
0
,
"http_url_to_repo"
:
"http://localhost:3000/root/ci-project.git"
,
"id"
:
9
,
"issues_enabled"
:
true
,
"last_activity_at"
:
"2016-08-11T11:32:53.239Z"
,
"merge_requests_enabled"
:
true
,
"name"
:
"ci-project"
,
"name_with_namespace"
:
"Administrator / ci-project"
,
"namespace"
:
{
"avatar"
:
null
,
"created_at"
:
"2016-08-11T07:09:20.585Z"
,
"deleted_at"
:
null
,
"description"
:
""
,
"id"
:
1
,
"name"
:
"root"
,
"owner_id"
:
1
,
"path"
:
"root"
,
"request_access_enabled"
:
true
,
"share_with_group_lock"
:
false
,
"updated_at"
:
"2016-08-11T07:09:20.585Z"
,
"visibility_level"
:
20
},
"open_issues_count"
:
0
,
"owner"
:
{
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon"
,
"id"
:
1
,
"name"
:
"Administrator"
,
"state"
:
"active"
,
"username"
:
"root"
,
"web_url"
:
"http://localhost:3000/u/root"
},
"path"
:
"ci-project"
,
"path_with_namespace"
:
"root/ci-project"
,
"public"
:
false
,
"public_builds"
:
true
,
"shared_runners_enabled"
:
true
,
"shared_with_groups"
:
[
],
"snippets_enabled"
:
false
,
"ssh_url_to_repo"
:
"ssh://zegerjan@localhost:2222/root/ci-project.git"
,
"star_count"
:
0
,
"tag_list"
:
[
],
"visibility_level"
:
0
,
"web_url"
:
"http://localhost:3000/root/ci-project"
,
"wiki_enabled"
:
true
},
"ref"
:
"master"
,
"sha"
:
"a91957a858320c0e17f3a0eca7cfacbff50ea29a"
,
"user"
:
{
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon"
,
"id"
:
1
,
"name"
:
"Administrator"
,
"state"
:
"active"
,
"username"
:
"root"
,
"web_url"
:
"http://localhost:3000/u/root"
}
}
]
```
## Get a specific deployment
```
GET /projects/:id/deployments/:deployment_id
```
| Attribute | Type | Required | Description |
|-----------|---------|----------|---------------------|
|
`id`
| integer | yes | The ID of a project |
|
`deployment_id`
| string | yes | The ID of the deployment |
```
bash
curl
--header
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
"https://gitlab.example.com/api/v3/projects/1/deployment/1"
```
Example of response
```
json
{
"id"
:
42
,
"iid"
:
2
,
"ref"
:
"master"
,
"sha"
:
"a91957a858320c0e17f3a0eca7cfacbff50ea29a"
,
"created_at"
:
"2016-08-11T11:32:35.444Z"
,
"project"
:
{
"id"
:
9
,
"description"
:
""
,
"default_branch"
:
"master"
,
"tag_list"
:
[],
"public"
:
false
,
"archived"
:
false
,
"visibility_level"
:
0
,
"ssh_url_to_repo"
:
"ssh://zegerjan@localhost:2222/root/ci-project.git"
,
"http_url_to_repo"
:
"http://localhost:3000/root/ci-project.git"
,
"web_url"
:
"http://localhost:3000/root/ci-project"
,
"owner"
:
{
"name"
:
"Administrator"
,
"username"
:
"root"
,
"id"
:
1
,
"state"
:
"active"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon"
,
"web_url"
:
"http://localhost:3000/u/root"
},
"name"
:
"ci-project"
,
"name_with_namespace"
:
"Administrator / ci-project"
,
"path"
:
"ci-project"
,
"path_with_namespace"
:
"root/ci-project"
,
"issues_enabled"
:
true
,
"merge_requests_enabled"
:
true
,
"wiki_enabled"
:
true
,
"builds_enabled"
:
true
,
"snippets_enabled"
:
false
,
"container_registry_enabled"
:
true
,
"created_at"
:
"2016-08-11T07:31:46.777Z"
,
"last_activity_at"
:
"2016-08-11T11:32:53.239Z"
,
"shared_runners_enabled"
:
true
,
"creator_id"
:
1
,
"namespace"
:
{
"id"
:
1
,
"name"
:
"root"
,
"path"
:
"root"
,
"owner_id"
:
1
,
"created_at"
:
"2016-08-11T07:09:20.585Z"
,
"updated_at"
:
"2016-08-11T07:09:20.585Z"
,
"description"
:
""
,
"avatar"
:
null
,
"share_with_group_lock"
:
false
,
"visibility_level"
:
20
,
"request_access_enabled"
:
true
,
"deleted_at"
:
null
},
"avatar_url"
:
null
,
"star_count"
:
0
,
"forks_count"
:
0
,
"open_issues_count"
:
0
,
"public_builds"
:
true
,
"shared_with_groups"
:
[]
},
"user"
:
{
"name"
:
"Administrator"
,
"username"
:
"root"
,
"id"
:
1
,
"state"
:
"active"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon"
,
"web_url"
:
"http://localhost:3000/u/root"
},
"environment"
:
{
"id"
:
9
,
"name"
:
"production"
,
"external_url"
:
"https://about.gitlab.com"
},
"deployable"
:
{
"id"
:
664
,
"status"
:
"success"
,
"stage"
:
"deploy"
,
"name"
:
"deploy"
,
"ref"
:
"master"
,
"tag"
:
false
,
"coverage"
:
null
,
"created_at"
:
"2016-08-11T11:32:24.456Z"
,
"started_at"
:
null
,
"finished_at"
:
"2016-08-11T11:32:35.145Z"
,
"user"
:
{
"name"
:
"Administrator"
,
"username"
:
"root"
,
"id"
:
1
,
"state"
:
"active"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon"
,
"web_url"
:
"http://localhost:3000/u/root"
,
"created_at"
:
"2016-08-11T07:09:20.351Z"
,
"is_admin"
:
true
,
"bio"
:
null
,
"location"
:
null
,
"skype"
:
""
,
"linkedin"
:
""
,
"twitter"
:
""
,
"website_url"
:
""
},
"commit"
:
{
"id"
:
"a91957a858320c0e17f3a0eca7cfacbff50ea29a"
,
"short_id"
:
"a91957a8"
,
"title"
:
"Merge branch 'rename-readme' into 'master'
\r
"
,
"author_name"
:
"Administrator"
,
"author_email"
:
"admin@example.com"
,
"created_at"
:
"2016-08-11T13:28:26.000+02:00"
,
"message"
:
"Merge branch 'rename-readme' into 'master'
\r\n\r\n
Rename README
\r\n\r\n\r\n\r\n
See merge request !2"
},
"runner"
:
null
}
}
```
spec/requests/api/deployments_spec.rb
浏览文件 @
182e2814
...
...
@@ -45,6 +45,7 @@ describe API::API, api: true do
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
[
'sha'
]).
to
match
/\A\h{40}\z/
expect
(
json_response
[
'id'
]).
to
eq
(
deployment
.
id
)
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录