Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Griffith <dyl.griffith@gmail.com>2018-02-22 09:03:00 +0300
committerDylan Griffith <dyl.griffith@gmail.com>2018-02-28 03:54:37 +0300
commitb5a5fdf0e3b97622789db444bf0bf697e78dbb47 (patch)
treecd91aeed35c2d88f916ba63f82f5f49aed8c8c3d /lib/api/helpers/runner.rb
parent0be4a77d0012613f960c4177f53101c46de2899c (diff)
Persist runner IP address on contact (#43489)
Diffstat (limited to 'lib/api/helpers/runner.rb')
-rw-r--r--lib/api/helpers/runner.rb18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/api/helpers/runner.rb b/lib/api/helpers/runner.rb
index fbe30192a16..35ac0b4cbca 100644
--- a/lib/api/helpers/runner.rb
+++ b/lib/api/helpers/runner.rb
@@ -9,16 +9,22 @@ module API
Gitlab::CurrentSettings.runners_registration_token)
end
- def get_runner_version_from_params
- return unless params['info'].present?
+ def authenticate_runner!
+ forbidden! unless current_runner
- attributes_for_keys(%w(name version revision platform architecture), params['info'])
+ current_runner
+ .update_cached_info(get_runner_details_from_request)
end
- def authenticate_runner!
- forbidden! unless current_runner
+ def get_runner_details_from_request
+ return get_runner_ip unless params['info'].present?
+
+ attributes_for_keys(%w(name version revision platform architecture), params['info'])
+ .merge(get_runner_ip)
+ end
- current_runner.update_cached_info(get_runner_version_from_params)
+ def get_runner_ip
+ { ip_address: request.ip }
end
def current_runner