1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
%h3
Web hooks
%p.light
Web Hooks can be used for binding events when build completed.
%hr.clearfix
= form_for [@project, @web_hook], html: { class: 'form-horizontal' } do |f|
-if @web_hook.errors.any?
.alert.alert-danger
- @web_hook.errors.full_messages.each do |msg|
%p= msg
.form-group
= f.label :url, "URL", class: 'control-label'
.col-sm-10
= f.text_field :url, class: "form-control", placeholder: 'http://example.com/trigger-ci.json'
.form-actions
= f.submit "Add Web Hook", class: "btn btn-create"
-if @web_hooks.any?
%h4 Activated web hooks (#{@web_hooks.count})
%table.table
- @web_hooks.each do |hook|
%tr
%td
.clearfix
%span.monospace= hook.url
%td
.pull-right
- if @project.commits.any?
= link_to 'Test Hook', test_project_web_hook_path(@project, hook), class: "btn btn-sm btn-grouped"
= link_to 'Remove', project_web_hook_path(@project, hook), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn btn-remove btn-sm btn-grouped"
%h4 Web Hook data example
:erb
<pre>
<code>
{
"build_id": 2,
"build_name":"rspec_linux"
"build_status": "failed",
"build_started_at": "2014-05-05T18:01:02.563Z",
"build_finished_at": "2014-05-05T18:01:07.611Z",
"project_id": 1,
"project_name": "Brightbox \/ Brightbox Cli",
"gitlab_url": "http:\/\/localhost:3000\/brightbox\/brightbox-cli",
"ref": "master",
"sha": "a26cf5de9ed9827746d4970872376b10d9325f40",
"before_sha": "34f57f6ba3ed0c21c5e361bbb041c3591411176c",
"push_data": {
"before": "34f57f6ba3ed0c21c5e361bbb041c3591411176c",
"after": "a26cf5de9ed9827746d4970872376b10d9325f40",
"ref": "refs\/heads\/master",
"user_id": 1,
"user_name": "Administrator",
"project_id": 5,
"repository": {
"name": "Brightbox Cli",
"url": "dzaporozhets@localhost:brightbox\/brightbox-cli.git",
"description": "Voluptatibus quae error consectetur voluptas dolores vel excepturi possimus.",
"homepage": "http:\/\/localhost:3000\/brightbox\/brightbox-cli"
},
"commits": [
{
"id": "a26cf5de9ed9827746d4970872376b10d9325f40",
"message": "Release v1.2.2",
"timestamp": "2014-04-22T16:46:42+03:00",
"url": "http:\/\/localhost:3000\/brightbox\/brightbox-cli\/commit\/a26cf5de9ed9827746d4970872376b10d9325f40",
"author": {
"name": "Paul Thornthwaite",
"email": "tokengeek@gmail.com"
}
},
{
"id": "34f57f6ba3ed0c21c5e361bbb041c3591411176c",
"message": "Fix server user data update\n\nIncorrect condition was being used so Base64 encoding option was having\nopposite effect from desired.",
"timestamp": "2014-04-11T18:17:26+03:00",
"url": "http:\/\/localhost:3000\/brightbox\/brightbox-cli\/commit\/34f57f6ba3ed0c21c5e361bbb041c3591411176c",
"author": {
"name": "Paul Thornthwaite",
"email": "tokengeek@gmail.com"
}
}
],
"total_commits_count": 2,
"ci_yaml_file":"rspec_linux:\r\n script: ls\r\n"
}
}
</code>
</pre>
|