diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-07-19 20:59:38 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-07-19 20:59:38 +0800 |
commit | 08b9532e376eae369cd04d9f86ea560acfd19ed0 (patch) | |
tree | 69ffbbe3425b96c3f097c7e8f9d23798bef21451 /app/models/project.rb | |
parent | 1cd573ee7f03bcb356478aab5900fae4618b53ec (diff) | |
download | gitlab-ce-08b9532e376eae369cd04d9f86ea560acfd19ed0.tar.gz |
API for downloading latest successful build:
This was extracted from !5142 and implementing part of #4255.
We split it from !5142 because we want to ship it in 8.10
while !5142 was not ready yet.
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index a805f5d97bc..29aaaf5117f 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -429,6 +429,13 @@ class Project < ActiveRecord::Base repository.commit(ref) end + # ref can't be HEAD, can only be branch/tag name or SHA + def latest_successful_builds_for(ref = 'master') + Ci::Build.joins(:pipeline). + merge(pipelines.latest_successful_for(ref)). + latest_successful_with_artifacts + end + def merge_base_commit(first_commit_id, second_commit_id) sha = repository.merge_base(first_commit_id, second_commit_id) repository.commit(sha) if sha |