Commit 590d61a2 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Also show latest pipeline for ImageForBuildService

parent 18a71c47
module Ci
class ImageForBuildService
def execute(project, opts)
sha = opts[:sha] || ref_sha(project, opts[:ref])
ref = opts[:ref]
sha = opts[:sha] || ref_sha(project, ref)
pipelines = project.pipelines.where(sha: sha)
pipelines = pipelines.where(ref: opts[:ref]) if opts[:ref]
image_name = image_for_status(pipelines.status)
latest_pipeline = if ref
pipelines.latest_for(ref)
else
pipelines.latest
end.first
image_name = image_for_status(latest_pipeline.status)
image_path = Rails.root.join('public/ci', image_name)
OpenStruct.new(path: image_path, name: image_name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment