diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-11-21 22:19:16 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-11-21 22:19:16 +0800 |
commit | 721f2d3788ae5e8374f357014bd9e20d62de0a81 (patch) | |
tree | 44c2f09930d5212e260d7b7fe1fc3ee023b37f65 /app/services/ci | |
parent | b20c7846ffc0c78d6b483184363b6ccc7c11326d (diff) | |
download | gitlab-ce-721f2d3788ae5e8374f357014bd9e20d62de0a81.tar.gz |
Still use compound pipeline status, but group by
ref and sha so that it would show latest pipeline
if ref and sha are both specified, otherwise still
the same as before.
Diffstat (limited to 'app/services/ci')
-rw-r--r-- | app/services/ci/image_for_build_service.rb | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/app/services/ci/image_for_build_service.rb b/app/services/ci/image_for_build_service.rb index 026a727a8f9..d5a07ef630b 100644 --- a/app/services/ci/image_for_build_service.rb +++ b/app/services/ci/image_for_build_service.rb @@ -3,18 +3,11 @@ module Ci def execute(project, opts) ref = opts[:ref] sha = opts[:sha] || ref_sha(project, ref) - pipelines = project.pipelines.where(sha: sha) - latest_pipeline = if ref - pipelines.latest_for(ref) - else - pipelines.latest - end.first - - image_name = image_for_status(latest_pipeline.try(:status)) - + image_name = image_for_status(pipelines.latest_for(ref).status) image_path = Rails.root.join('public/ci', image_name) + OpenStruct.new(path: image_path, name: image_name) end |