summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-10-24 12:27:27 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-10-24 12:27:27 +0300
commit608b3da982cd22ed2f7732915a2db8a5f214ce23 (patch)
tree0f49146809f01c8453e4eacec600c266b34d37e3 /lib
parentc05241d5656f9688293547429ff3eea3346c605e (diff)
downloadgitlab-ci-608b3da982cd22ed2f7732915a2db8a5f214ce23.tar.gz
Runner is shared between all projects now unless it is assigned to any of them
Diffstat (limited to 'lib')
-rw-r--r--lib/api/builds.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/api/builds.rb b/lib/api/builds.rb
index 3b70a88..2421c4f 100644
--- a/lib/api/builds.rb
+++ b/lib/api/builds.rb
@@ -15,7 +15,10 @@ module API
required_attributes! [:token]
ActiveRecord::Base.transaction do
- build = Build.where(project_id: current_runner.projects).pending.order('created_at ASC').first
+ builds = Build.scoped
+ builds = builds.where(project_id: current_runner.projects) unless current_runner.shared?
+ build = builds.first_pending
+
not_found! and return unless build
build.run!
@@ -32,7 +35,7 @@ module API
# Example Request:
# PUT /builds/:id
put ":id" do
- build = Build.where(project_id: current_runner.projects).find(params[:id])
+ build = Build.where(runner_id: current_runner.id).find(params[:id])
build.update_attributes(trace: params[:trace], runner_id: current_runner.id)
case params[:state].to_s