diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-02-27 11:46:55 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-02-27 11:46:55 +0000 |
commit | 3e8d63293e420f21bf8c26830cfdcfcedb6c7e05 (patch) | |
tree | a282bc309e682956b07d25602569f426ea164d35 /lib/api/helpers | |
parent | c72c8e9a0effb2947c47977c2bb686578193aaba (diff) | |
parent | e25f26e5503a5aa07f5cfc436e10b92254185f9a (diff) | |
download | gitlab-ce-3e8d63293e420f21bf8c26830cfdcfcedb6c7e05.tar.gz |
Merge branch 'feature/runners-v4-api' into 'master'
Add Runner registration/deletion API
See merge request !9246
Diffstat (limited to 'lib/api/helpers')
-rw-r--r-- | lib/api/helpers/runner.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/api/helpers/runner.rb b/lib/api/helpers/runner.rb new file mode 100644 index 00000000000..119ca81b883 --- /dev/null +++ b/lib/api/helpers/runner.rb @@ -0,0 +1,23 @@ +module API + module Helpers + module Runner + def runner_registration_token_valid? + ActiveSupport::SecurityUtils.variable_size_secure_compare(params[:token], + current_application_settings.runners_registration_token) + end + + def get_runner_version_from_params + return unless params['info'].present? + attributes_for_keys(%w(name version revision platform architecture), params['info']) + end + + def authenticate_runner! + forbidden! unless current_runner + end + + def current_runner + @runner ||= ::Ci::Runner.find_by_token(params[:token].to_s) + end + end + end +end |