diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-10-24 13:17:47 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-10-24 13:17:47 +0300 |
commit | d82c78bccd31ad7babfd472b9b812b43001b9f60 (patch) | |
tree | 2e686d8b8b6cb1ddd2b175a3cfcefb45957b4410 /lib/api | |
parent | 19876b498e2a0fb1d840c64481143b4b4de836d2 (diff) | |
download | gitlab-ci-d82c78bccd31ad7babfd472b9b812b43001b9f60.tar.gz |
Assign runner id to build at start. Allow update only of running builds
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/builds.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/api/builds.rb b/lib/api/builds.rb index 2421c4f..a77c63d 100644 --- a/lib/api/builds.rb +++ b/lib/api/builds.rb @@ -21,6 +21,8 @@ module API not_found! and return unless build + build.runner_id = current_runner.id + build.save! build.run! present build, with: Entities::Build end @@ -35,8 +37,8 @@ module API # Example Request: # PUT /builds/:id put ":id" do - build = Build.where(runner_id: current_runner.id).find(params[:id]) - build.update_attributes(trace: params[:trace], runner_id: current_runner.id) + build = Build.where(runner_id: current_runner.id).running.find(params[:id]) + build.update_attributes(trace: params[:trace]) case params[:state].to_s when 'success' |