diff options
author | Kestred <kestred@riotcave.com> | 2014-08-23 22:27:52 -0700 |
---|---|---|
committer | Kestred <kestred@riotcave.com> | 2014-08-23 22:27:52 -0700 |
commit | 18f954b31c242822b6c7430a50ca99a93adc6ea6 (patch) | |
tree | b7ee4acac738d5b64b6fcfaf909756f784dd2d61 /lib/api | |
parent | 2eb3d91e1a6e51d3ca0be2fe0a5df750708b366d (diff) | |
download | gitlab-ci-18f954b31c242822b6c7430a50ca99a93adc6ea6.tar.gz |
Separate Commit model and logic from Build model|etc...
This is an entirely non-user facing change which prepares GitLab CI for future support of Parallel Builds.
See https://about.gitlab.com/2013/12/19/gitlab-ci-with-parallel-builds-and-deployments/.
These changes specifically avoid changing the supported API or changing any of the website views.
Changes to the website views will come in tandem with future features like "Multiple build scripts".
The supported API won't change as part of any future changes on this vein, to maintain support for the unofficial GitLab CI runners.
This closes the following implementation step:
1. A commit has many builds
Signed-off-by: Kestred <kestred@riotcave.com>
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/builds.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/api/builds.rb b/lib/api/builds.rb index 6ecc248..f96c1d4 100644 --- a/lib/api/builds.rb +++ b/lib/api/builds.rb @@ -14,9 +14,12 @@ module API required_attributes! [:token] ActiveRecord::Base.transaction do - builds = Build.all - builds = builds.where(project_id: current_runner.projects) unless current_runner.shared? - build = builds.first_pending + build = if current_runner.shared? + Build.first_pending + else + commits = Commit.where(project_id: current_runner.projects) + Build.where(commit_id: commits).first_pending + end not_found! and return unless build |