summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG1
-rw-r--r--lib/api/runners.rb10
-rw-r--r--spec/requests/api/runners_spec.rb7
3 files changed, 16 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 0cb4c23..fa47988 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
v7.8.0
- Fix OAuth login with GitLab installed in relative URL
- GitLab CI has same version as GitLab since now
+ - Allow to pass hostname and tag list during Runner's registration
v5.4.1
- Fix 500 if on builds page if build has no job
diff --git a/lib/api/runners.rb b/lib/api/runners.rb
index 79d0b56..16abe00 100644
--- a/lib/api/runners.rb
+++ b/lib/api/runners.rb
@@ -33,10 +33,16 @@ module API
runner =
if params[:token] == GitlabCi::REGISTRATION_TOKEN
# Create shared runner. Requires admin access
- Runner.create(description: params[:hostname])
+ Runner.create(
+ description: params[:hostname],
+ tag_list: params[:tag_list]
+ )
elsif project = Project.find_by(token: params[:token])
# Create a specific runner for project.
- project.runners.create(description: params[:hostname])
+ project.runners.create(
+ description: params[:hostname],
+ tag_list: params[:tag_list]
+ )
end
return forbidden! unless runner
diff --git a/spec/requests/api/runners_spec.rb b/spec/requests/api/runners_spec.rb
index eb5e0ae..71557a3 100644
--- a/spec/requests/api/runners_spec.rb
+++ b/spec/requests/api/runners_spec.rb
@@ -52,6 +52,13 @@ describe API::API do
it { Runner.first.description.should == "server.hostname" }
end
+ describe "should create a runner with tags" do
+ before { post api("/runners/register"), token: GitlabCi::REGISTRATION_TOKEN, tag_list: "tag1, tag2" }
+
+ it { response.status.should == 201 }
+ it { Runner.first.tag_list.sort.should == ["tag1", "tag2"] }
+ end
+
describe "should create a runner if project token provided" do
let(:project) { FactoryGirl.create(:project) }
before { post api("/runners/register"), token: project.token }