summaryrefslogtreecommitdiff
path: root/lib/api/helpers
diff options
context:
space:
mode:
authorClement Ho <clemmakesapps@gmail.com>2018-02-28 18:40:06 +0000
committerClement Ho <clemmakesapps@gmail.com>2018-02-28 18:40:06 +0000
commit9353c5c780c7af6d6ed3d6c501b155f82debc99c (patch)
tree55d87571798f5ff10ee1431a296f1115251f67e9 /lib/api/helpers
parentc287c01821c4db4830dbdd5263907f08c2ed4cc4 (diff)
parente2638c3ff2714e5efd4bc54e64555fc564c84af1 (diff)
downloadgitlab-ce-pipelines_show_refactor.tar.gz
Merge branch 'master' into 'pipelines_show_refactor'pipelines_show_refactor
# Conflicts: # config/webpack.config.js
Diffstat (limited to 'lib/api/helpers')
-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