Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2015-10-26 14:23:34 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2015-10-26 14:23:40 +0300
commit271ad4e354d10c7ff59f57a1852c5a97e3621273 (patch)
tree206030579275244ac1529d9a1661fec876570f1e /app/services
parentbf30332ea8adf067b8c9aaad3b934749b7e6f71e (diff)
Fix CI badge
The previous code relied on having on ref stored in commit, however the ref was moved to the build.
Diffstat (limited to 'app/services')
-rw-r--r--app/services/ci/image_for_build_service.rb16
1 files changed, 7 insertions, 9 deletions
diff --git a/app/services/ci/image_for_build_service.rb b/app/services/ci/image_for_build_service.rb
index b95835ba093..b8d24193035 100644
--- a/app/services/ci/image_for_build_service.rb
+++ b/app/services/ci/image_for_build_service.rb
@@ -1,17 +1,15 @@
module Ci
class ImageForBuildService
def execute(project, params)
- image_name =
- if params[:sha]
- commit = project.commits.find_by(sha: params[:sha])
- image_for_commit(commit)
- elsif params[:ref]
- commit = project.last_commit_for_ref(params[:ref])
- image_for_commit(commit)
- else
- 'build-unknown.svg'
+ sha = params[:sha]
+ sha ||=
+ if params[:ref]
+ project.gl_project.commit(params[:ref]).try(:sha)
end
+ commit = project.commits.ordered.find_by(sha: sha)
+ image_name = image_for_commit(commit)
+
image_path = Rails.root.join('public/ci', image_name)
OpenStruct.new(