diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-10-26 12:23:34 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-10-26 12:23:40 +0100 |
commit | 271ad4e354d10c7ff59f57a1852c5a97e3621273 (patch) | |
tree | 206030579275244ac1529d9a1661fec876570f1e /app/services/ci | |
parent | bf30332ea8adf067b8c9aaad3b934749b7e6f71e (diff) | |
download | gitlab-ce-271ad4e354d10c7ff59f57a1852c5a97e3621273.tar.gz |
Fix CI badgefix-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/ci')
-rw-r--r-- | app/services/ci/image_for_build_service.rb | 16 |
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( |