diff options
author | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2015-02-20 21:40:59 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-02-20 14:45:26 -0800 |
commit | 3360ee876a104459a343f8f82c51b90ba4a717af (patch) | |
tree | f5049d31691c1c052e69b582889ddaa6037f76b2 | |
parent | b4d3f115054362bbe291df771782267f324ea28b (diff) | |
download | gitlab-ce-3360ee876a104459a343f8f82c51b90ba4a717af.tar.gz |
Merge branch 'improve-web-hooks' into 'master'
Improve web hooks
* add git_http_url and git_ssh_url to project web hook
* add visibility_level to project web hook
* add documentation about project visibility_level in API
Fixes #2018, #2030
cc @sytse
See merge request !1560
-rw-r--r-- | CHANGELOG | 2 | ||||
-rw-r--r-- | doc/api/projects.md | 18 | ||||
-rw-r--r-- | doc/web_hooks/web_hooks.md | 20 | ||||
-rw-r--r-- | lib/gitlab/push_data_builder.rb | 3 | ||||
-rw-r--r-- | spec/lib/gitlab/push_data_builder_spec.rb | 3 |
5 files changed, 40 insertions, 6 deletions
diff --git a/CHANGELOG b/CHANGELOG index 190d45aeb28..7e6b0dff266 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -60,6 +60,8 @@ v 7.8.0 (unreleased) - Remove deprecated Group#owner_id from API - Show projects user contributed to on user page. Show stars near project on user page. - Improve database performance for GitLab + - Add Asana service (Jeremy Benoist) + - Improve project web hooks with extra data v 7.7.2 - Update GitLab Shell to version 2.4.2 that fixes a bug when developers can push to protected branch diff --git a/doc/api/projects.md b/doc/api/projects.md index 454f6fa2e91..a1a23051d7e 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -1,5 +1,23 @@ # Projects + +### Project visibility level + +Project in GitLab has be either private, internal or public. +You can determine it by `visibility_level` field in project. + +Constants for project visibility levels are next: + +* Private. `visibility_level` is `0`. + Project access must be granted explicitly for each user. + +* Internal. `visibility_level` is `10`. + The project can be cloned by any logged in user. + +* Public. `visibility_level` is `20`. + The project can be cloned without any authentication. + + ## List projects Get a list of projects accessible by the authenticated user. diff --git a/doc/web_hooks/web_hooks.md b/doc/web_hooks/web_hooks.md index e3399e5f1b8..29ef5b59bac 100644 --- a/doc/web_hooks/web_hooks.md +++ b/doc/web_hooks/web_hooks.md @@ -24,16 +24,19 @@ Triggered when you push to the repository except when pushing tags. "project_id": 15, "repository": { "name": "Diaspora", - "url": "git@example.com:diaspora.git", + "url": "git@example.com:mike/diasporadiaspora.git", "description": "", - "homepage": "http://example.com/diaspora" + "homepage": "http://example.com/mike/diaspora", + "git_http_url":"http://example.com/mike/diaspora.git", + "git_ssh_url":"git@example.com:mike/diaspora.git", + "visibility_level":0 }, "commits": [ { "id": "b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327", "message": "Update Catalan translation to e38cb41.", "timestamp": "2011-12-12T14:27:31+02:00", - "url": "http://example.com/diaspora/commits/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327", + "url": "http://example.com/mike/diaspora/commit/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327", "author": { "name": "Jordi Mallach", "email": "jordi@softcatala.org" @@ -43,7 +46,7 @@ Triggered when you push to the repository except when pushing tags. "id": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", "message": "fixed readme", "timestamp": "2012-01-03T23:36:29+02:00", - "url": "http://example.com/diaspora/commits/da1560886d4f094c3e6c9ef40349f7d38b5d27d7", + "url": "http://example.com/mike/diaspora/commit/da1560886d4f094c3e6c9ef40349f7d38b5d27d7", "author": { "name": "GitLab dev user", "email": "gitlabdev@dv6700.(none)" @@ -72,8 +75,13 @@ Triggered when you create (or delete) tags to the repository. "name": "jsmith", "url": "ssh://git@example.com/jsmith/example.git", "description": "", - "homepage": "http://example.com/jsmith/example" - } + "homepage": "http://example.com/jsmith/example", + "git_http_url":"http://example.com/jsmith/example.git", + "git_ssh_url":"git@example.com:jsmith/example.git", + "visibility_level":0 + }, + "commits": [], + "total_commits_count": 0 } ``` diff --git a/lib/gitlab/push_data_builder.rb b/lib/gitlab/push_data_builder.rb index faea6ae375c..9aa5c8967a7 100644 --- a/lib/gitlab/push_data_builder.rb +++ b/lib/gitlab/push_data_builder.rb @@ -41,6 +41,9 @@ module Gitlab url: project.url_to_repo, description: project.description, homepage: project.web_url, + git_http_url: project.http_url_to_repo, + git_ssh_url: project.ssh_url_to_repo, + visibility_level: project.visibility_level }, commits: [], total_commits_count: commits_count diff --git a/spec/lib/gitlab/push_data_builder_spec.rb b/spec/lib/gitlab/push_data_builder_spec.rb index da25d45f1ff..1b8ba7b4d43 100644 --- a/spec/lib/gitlab/push_data_builder_spec.rb +++ b/spec/lib/gitlab/push_data_builder_spec.rb @@ -13,6 +13,9 @@ describe 'Gitlab::PushDataBuilder' do it { expect(data[:after]).to eq('5937ac0a7beb003549fc5fd26fc247adbce4a52e') } it { expect(data[:ref]).to eq('refs/heads/master') } it { expect(data[:commits].size).to eq(3) } + it { expect(data[:repository][:git_http_url]).to eq(project.http_url_to_repo) } + it { expect(data[:repository][:git_ssh_url]).to eq(project.ssh_url_to_repo) } + it { expect(data[:repository][:visibility_level]).to eq(project.visibility_level) } it { expect(data[:total_commits_count]).to eq(3) } end |