summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2015-01-23 23:39:27 +0000
committerValery Sizov <valery@gitlab.com>2015-01-23 23:39:27 +0000
commit8725f87d28b1453d97fe8fc8db5c7dcfe03c9652 (patch)
treec062f2b807bf6304f35027d8ebb40556c37e4023
parent3540fb595542b690806d83412f93e2e651c029d4 (diff)
parentc4613f09e24371b0d06641aff9746701e3f590c3 (diff)
downloadgitlab-ci-8725f87d28b1453d97fe8fc8db5c7dcfe03c9652.tar.gz
Merge branch 'receive-hostname' into 'master'
Receive hostname Coordinator consumes Runner's hostname and uses it's as a description during registration. This MR is required to make it work: https://gitlab.com/gitlab-org/gitlab-ci-runner/merge_requests/10 See merge request !28
-rw-r--r--lib/api/runners.rb4
-rw-r--r--spec/requests/api/runners_spec.rb7
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/api/runners.rb b/lib/api/runners.rb
index f8239a1..79d0b56 100644
--- a/lib/api/runners.rb
+++ b/lib/api/runners.rb
@@ -33,10 +33,10 @@ module API
runner =
if params[:token] == GitlabCi::REGISTRATION_TOKEN
# Create shared runner. Requires admin access
- Runner.create
+ Runner.create(description: params[:hostname])
elsif project = Project.find_by(token: params[:token])
# Create a specific runner for project.
- project.runners.create
+ project.runners.create(description: params[:hostname])
end
return forbidden! unless runner
diff --git a/spec/requests/api/runners_spec.rb b/spec/requests/api/runners_spec.rb
index 7e35e5b..eb5e0ae 100644
--- a/spec/requests/api/runners_spec.rb
+++ b/spec/requests/api/runners_spec.rb
@@ -45,6 +45,13 @@ describe API::API do
it { response.status.should == 201 }
end
+ describe "should create a runner with description" do
+ before { post api("/runners/register"), token: GitlabCi::REGISTRATION_TOKEN, hostname: "server.hostname" }
+
+ it { response.status.should == 201 }
+ it { Runner.first.description.should == "server.hostname" }
+ end
+
describe "should create a runner if project token provided" do
let(:project) { FactoryGirl.create(:project) }
before { post api("/runners/register"), token: project.token }