Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gitlab CI: optional SSL certificate validation
--- a/app/models/network.rb
+++ b/app/models/network.rb
@@ -7,6 +7,7 @@ class Network
opts = {
body: api_opts.to_json,
headers: {"Content-Type" => "application/json"},
+ verify: verify?
}
endpoint = File.join(url, API_PREFIX, 'session.json')
@@ -23,6 +24,7 @@ class Network
opts = {
query: api_opts,
headers: {"Content-Type" => "application/json"},
+ verify: verify?
}
endpoint = File.join(url, API_PREFIX, 'user.json')
@@ -109,4 +111,10 @@ class Network
nil
end
end
+
+ protected
+
+ def verify?
+ GitlabCi.config[:verify_ssl] || true
+ end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.