diff options
author | Gabriel Mazetto <gabriel@gitlab.com> | 2016-04-15 08:08:22 -0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-04-19 11:00:30 +0200 |
commit | ee1090e2b2bc7b3762f6e2775f3fd15e92ae212b (patch) | |
tree | 9df863f27349ca2a95d0e6f16d99b85d4806d992 /lib | |
parent | 53a1d705fe536ad373faa77ba1ef5196ff49a98b (diff) | |
download | gitlab-ce-ee1090e2b2bc7b3762f6e2775f3fd15e92ae212b.tar.gz |
Added System Hooks for push and tag_push
Code is based on Project Webhooks, removing deprecations and without
commits listing.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/push_data_builder.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/gitlab/push_data_builder.rb b/lib/gitlab/push_data_builder.rb index 97d1edab9c1..eb8e45040bc 100644 --- a/lib/gitlab/push_data_builder.rb +++ b/lib/gitlab/push_data_builder.rb @@ -36,7 +36,7 @@ module Gitlab commit.hook_attrs(with_changed_files: true) end - type = Gitlab::Git.tag_ref?(ref) ? "tag_push" : "push" + type = Gitlab::Git.tag_ref?(ref) ? 'tag_push' : 'push' # Hash to be passed as post_receive_data data = { @@ -62,6 +62,26 @@ module Gitlab data end + def build_system(project, user, oldrev, newrev, ref) + type = Gitlab::Git.tag_ref?(ref) ? 'tag_push' : 'push' + + data = { + event_name: type, + before: oldrev, + after: newrev, + ref: ref, + checkout_sha: checkout_sha(project.repository, newrev, ref), + user_id: user.id, + user_name: user.name, + user_email: user.email, + user_avatar: user.avatar_url, + project_id: project.id, + project: project.hook_attrs(backward: false) + } + + data + end + # This method provide a sample data generated with # existing project and commits to test webhooks def build_sample(project, user) |