summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2016-12-15 19:48:00 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2016-12-15 19:48:00 +0000
commitf3c2855f8e2c5cffe5548ff95dbeec6fe56446f0 (patch)
treeaab2c008633ca80f1e3b7e6836c5d146dd8ba514 /app/services
parent4530e68c6f9f05350a2aff5332eddae25b27537a (diff)
parentd9000184e5e8a63e0c24fe264e864fc27f6515c4 (diff)
downloadgitlab-ce-f3c2855f8e2c5cffe5548ff95dbeec6fe56446f0.tar.gz
Merge branch 'show-commit-status-from-latest-pipeline' into 'master'
Show commit status from latest pipeline Show commit status from latest pipeline rather than compound status from all pipelines. Closes #20560 See merge request !7333
Diffstat (limited to 'app/services')
-rw-r--r--app/services/ci/image_for_build_service.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/services/ci/image_for_build_service.rb b/app/services/ci/image_for_build_service.rb
index 75d847d5bee..240ddabec36 100644
--- a/app/services/ci/image_for_build_service.rb
+++ b/app/services/ci/image_for_build_service.rb
@@ -1,13 +1,13 @@
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)
+ image_name = image_for_status(pipelines.latest_status(ref))
image_path = Rails.root.join('public/ci', image_name)
+
OpenStruct.new(path: image_path, name: image_name)
end