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:
authorTomasz Maczukin <tomasz@maczukin.pl>2017-03-15 02:27:10 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2017-03-20 11:40:36 +0300
commitbbf4d27a5c046f95b6fda109dcda109fd00298b1 (patch)
tree20fabb8336543510712c24a0fd4434fc26181941 /lib/api/runner.rb
parent691402fb2b361ba19db3b8bdf77b75e513883423 (diff)
Make runner's veryfication working again
In APIv1 we were using UpdateJob to verify if the runner exists. It was the only method that was using Runner's token and used in special way had no side effects (like scheduling a new job or unregisterring a Runner). In APIv4 we've change UpdateJob to use job's token as authentication credentials, and that way we've removed the only endpoint that could be used to verify if the Runner with a certain token exists in target GitLab installation. This commit adds `POST /api/v4/runners/verify` endpoint whose only responsibility is to respond if Runner with posted credentials exists or not.
Diffstat (limited to 'lib/api/runner.rb')
-rw-r--r--lib/api/runner.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/api/runner.rb b/lib/api/runner.rb
index c700d2ef4a1..b80f7284735 100644
--- a/lib/api/runner.rb
+++ b/lib/api/runner.rb
@@ -47,6 +47,17 @@ module API
authenticate_runner!
Ci::Runner.find_by_token(params[:token]).destroy
end
+
+ desc 'Validates authentication credentials' do
+ http_codes [[200, 'Credentials are valid'], [403, 'Forbidden']]
+ end
+ params do
+ requires :token, type: String, desc: %q(Runner's authentication token)
+ end
+ post '/verify' do
+ authenticate_runner!
+ status 200
+ end
end
resource :jobs do