summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorValery Sizov <vsv2711@gmail.com>2015-08-11 09:59:40 +0300
committerValery Sizov <vsv2711@gmail.com>2015-08-26 15:48:31 +0300
commitbafffb2d14e1924154d5b7c74c7b3cbcf8c898fd (patch)
tree9e404f30a04e41e2e70456f2959a1780717981ae /app/models
parentadd099b024cc4155a5be494fdb9ae339fd073a14 (diff)
downloadgitlab-ce-bafffb2d14e1924154d5b7c74c7b3cbcf8c898fd.tar.gz
Enable SSL verification for Webhooksenable_ssl_verification_web_hook
Diffstat (limited to 'app/models')
-rw-r--r--app/models/hooks/web_hook.rb5
-rw-r--r--app/models/project_services/buildkite_service.rb9
-rw-r--r--app/models/project_services/gitlab_ci_service.rb6
3 files changed, 14 insertions, 6 deletions
diff --git a/app/models/hooks/web_hook.rb b/app/models/hooks/web_hook.rb
index 46fb85336e5..9a8251bdad5 100644
--- a/app/models/hooks/web_hook.rb
+++ b/app/models/hooks/web_hook.rb
@@ -25,6 +25,7 @@ class WebHook < ActiveRecord::Base
default_value_for :note_events, false
default_value_for :merge_requests_events, false
default_value_for :tag_push_events, false
+ default_value_for :enable_ssl_verification, false
# HTTParty timeout
default_timeout Gitlab.config.gitlab.webhook_timeout
@@ -41,7 +42,7 @@ class WebHook < ActiveRecord::Base
"Content-Type" => "application/json",
"X-Gitlab-Event" => hook_name.singularize.titleize
},
- verify: false)
+ verify: enable_ssl_verification)
else
post_url = url.gsub("#{parsed_url.userinfo}@", "")
auth = {
@@ -54,7 +55,7 @@ class WebHook < ActiveRecord::Base
"Content-Type" => "application/json",
"X-Gitlab-Event" => hook_name.singularize.titleize
},
- verify: false,
+ verify: enable_ssl_verification,
basic_auth: auth)
end
rescue SocketError, Errno::ECONNRESET, Errno::ECONNREFUSED, Net::OpenTimeout => e
diff --git a/app/models/project_services/buildkite_service.rb b/app/models/project_services/buildkite_service.rb
index a714bc82246..9e5da6f45d2 100644
--- a/app/models/project_services/buildkite_service.rb
+++ b/app/models/project_services/buildkite_service.rb
@@ -23,7 +23,7 @@ require "addressable/uri"
class BuildkiteService < CiService
ENDPOINT = "https://buildkite.com"
- prop_accessor :project_url, :token
+ prop_accessor :project_url, :token, :enable_ssl_verification
validates :project_url, presence: true, if: :activated?
validates :token, presence: true, if: :activated?
@@ -37,6 +37,7 @@ class BuildkiteService < CiService
def compose_service_hook
hook = service_hook || build_service_hook
hook.url = webhook_url
+ hook.enable_ssl_verification = enable_ssl_verification
hook.save
end
@@ -96,7 +97,11 @@ class BuildkiteService < CiService
{ type: 'text',
name: 'project_url',
- placeholder: "#{ENDPOINT}/example/project" }
+ placeholder: "#{ENDPOINT}/example/project" },
+
+ { type: 'checkbox',
+ name: 'enable_ssl_verification',
+ title: "Enable SSL verification" }
]
end
diff --git a/app/models/project_services/gitlab_ci_service.rb b/app/models/project_services/gitlab_ci_service.rb
index ecdcd48ae60..acbbc9935b6 100644
--- a/app/models/project_services/gitlab_ci_service.rb
+++ b/app/models/project_services/gitlab_ci_service.rb
@@ -21,7 +21,7 @@
class GitlabCiService < CiService
API_PREFIX = "api/v1"
- prop_accessor :project_url, :token
+ prop_accessor :project_url, :token, :enable_ssl_verification
validates :project_url,
presence: true,
format: { with: /\A#{URI.regexp(%w(http https))}\z/, message: "should be a valid url" }, if: :activated?
@@ -34,6 +34,7 @@ class GitlabCiService < CiService
def compose_service_hook
hook = service_hook || build_service_hook
hook.url = [project_url, "/build", "?token=#{token}"].join("")
+ hook.enable_ssl_verification = enable_ssl_verification
hook.save
end
@@ -136,7 +137,8 @@ class GitlabCiService < CiService
def fields
[
{ type: 'text', name: 'token', placeholder: 'GitLab CI project specific token' },
- { type: 'text', name: 'project_url', placeholder: 'http://ci.gitlabhq.com/projects/3' }
+ { type: 'text', name: 'project_url', placeholder: 'http://ci.gitlabhq.com/projects/3' },
+ { type: 'checkbox', name: 'enable_ssl_verification', title: "Enable SSL verification" }
]
end