/
config_sample.rb
87 lines (67 loc) · 1.67 KB
/
config_sample.rb
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
token "token"
# ssl_verify false
target "jenkins" do
hook_type [:push]
url "http://targethost.dev/job/JobName"
http_method :post
parameter_type :query
params key1: "value1", key2: "value2"
match ->(event) {
event.ref =~ /master/
}
end
target "json_params" do
hook_type [:push, :pull_request]
url "http://targethost.dev/job/JobName"
http_method :post
parameter_type :json
params key1: "value1", key2: "value2"
match ->(event) {
case event
when Octogate::Event::PullRequest
event.try(:pull_request).try(:head).try(:ref) =~ /json_params/
when Octogate::Event::Push
event.ref =~ /json_params/
end
}
end
target "block params" do
hook_type [:push, :pull_request]
url "http://targethost.dev/job/JobName"
http_method :post
parameter_type :query
params ->(event) { {ref: event.ref, head_commit_id: event.head_commit.id, method: http_method} }
match ->(event) {
event.ref =~ /block_parameters/
}
end
target "basic auth" do
hook_type [:push, :pull_request]
url "http://targethost.dev/job/JobName"
http_method :post
username "username_sample"
password "password_sample"
parameter_type :query
params key1: "value1", key2: "value2"
match ->(event) {
event.ref =~ /basic_auth/
}
end
target "always" do
hook_type [:push, :pull_request]
url "http://targethost.dev/job/JobName"
http_method :post
params always: "true"
end
target "always_push_only" do
url "http://targethost.dev/job/JobName"
http_method :post
params always: "push_only"
end
target "never" do
hook_type [:push, :pull_request]
url "http://targethost.dev/job/JobName"
http_method :post
params never: "true"
match false
end