diff options
author | Valery Sizov <valery@gitlab.com> | 2015-01-28 20:10:56 +0000 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2015-01-28 20:10:56 +0000 |
commit | 9477da8b510a4a40e608c72891d76d4fb0b79978 (patch) | |
tree | e901f3da799860c3f6891fdf918ce8c38156a906 | |
parent | bb045a45235f4258daa2ae9bfb0ae89aba18bade (diff) | |
parent | e8d7d327426138f9ea3737fd77e36ff2ac1299ea (diff) | |
download | gitlab-ci-9477da8b510a4a40e608c72891d76d4fb0b79978.tar.gz |
Merge branch 'tag_list' into 'master'
Allow to receive tag_list from Runner
This enables CI to receive tag_list from Runner's during registration.
Test results are here: https://semaphoreapp.com/ayufan/gitlab-ci/branches/tag_list
This MR requires gitlab-org/gitlab-ci-runner!11
See merge request !32
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | lib/api/runners.rb | 10 | ||||
-rw-r--r-- | spec/requests/api/runners_spec.rb | 7 |
3 files changed, 16 insertions, 2 deletions
@@ -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 } |