summaryrefslogtreecommitdiff
path: root/app/models/commit.rb
diff options
context:
space:
mode:
authorValery Sizov <vsv2711@gmail.com>2015-02-27 14:58:19 +0200
committerValery Sizov <vsv2711@gmail.com>2015-03-02 14:32:13 +0200
commit00d79e159086e55d8e06c55e0bdd5ee5b1779f34 (patch)
tree472715adae5aadfd4421f10658b68170a84d1102 /app/models/commit.rb
parent83835d271fa8fb04fae5c422afeacfba6f061629 (diff)
downloadgitlab-ci-00d79e159086e55d8e06c55e0bdd5ee5b1779f34.tar.gz
Deploy jobs
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r--app/models/commit.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 4943d66..7cf919c 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -31,7 +31,7 @@ class Commit < ActiveRecord::Base
end
def last_build
- builds.last
+ builds.order(:id).last
end
def retry
@@ -97,13 +97,13 @@ class Commit < ActiveRecord::Base
end
def create_builds
- project.jobs.where(build_branches: true).active.map do |job|
+ project.jobs.where(build_branches: true).active.parallel.map do |job|
create_build_from_job(job)
end
end
def create_builds_for_tag(ref = '')
- project.jobs.where(build_tags: true).active.map do |job|
+ project.jobs.where(build_tags: true).active.parallel.map do |job|
create_build_from_job(job, ref)
end
end
@@ -132,6 +132,16 @@ class Commit < ActiveRecord::Base
@retried_builds ||= (builds - builds_without_retry)
end
+ def run_deploy_job(ref)
+ if success? && !last_build.job.deploy?
+ project.jobs.deploy.active.each do |job|
+ if job.run_for_ref?(ref)
+ create_build_from_job(job)
+ end
+ end
+ end
+ end
+
def status
if success?
'success'