diff --git a/CHANGELOG b/CHANGELOG index 39651675e79663e64343abc1b78e3906ab4a3a6e..7bc020c8d68d0069f7c5923be481d35cdf0cec81 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -117,6 +117,7 @@ v 8.10.0 (unreleased) - Create Todos for Issue author when assign or mention himself (Katarzyna Kobierska) - Limit the number of retries on error to 3 for exporting projects - Allow empty repositories on project import/export + - Render only commit message title in builds (Katarzyna Kobierska Ula Budziszewska) v 8.9.6 - Fix importing of events under notes for GitLab projects. !5154 diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index b468434866be1e26a21908f31b62bc92241c7b1d..a65a826536de8f4fdc8a43a5e25b238a664035c1 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -51,6 +51,10 @@ module Ci commit.try(:message) end + def git_commit_title + commit.try(:title) + end + def short_sha Ci::Pipeline.truncate_sha(sha) end diff --git a/app/views/projects/builds/_sidebar.html.haml b/app/views/projects/builds/_sidebar.html.haml index cab21f0cf19568bad1443c6cc5d64d5902cfd01e..396cc4ad925d737e694963a099f8fd181efe5427 100644 --- a/app/views/projects/builds/_sidebar.html.haml +++ b/app/views/projects/builds/_sidebar.html.haml @@ -94,9 +94,9 @@ .block .title - Commit message + Commit title %p.build-light-text.append-bottom-0 - #{@build.pipeline.git_commit_message} + #{@build.pipeline.git_commit_title} - if @build.tags.any? .block diff --git a/spec/views/projects/builds/show.html.haml_spec.rb b/spec/views/projects/builds/show.html.haml_spec.rb index cd18d19ef5e7c2cbc5eedd34bd7b4e146a8b696b..42220a20c75bef6f547687af1b4cdaa08f26d93d 100644 --- a/spec/views/projects/builds/show.html.haml_spec.rb +++ b/spec/views/projects/builds/show.html.haml_spec.rb @@ -3,8 +3,12 @@ require 'spec_helper' describe 'projects/builds/show' do include Devise::TestHelpers - let(:build) { create(:ci_build) } - let(:project) { build.project } + let(:project) { create(:project) } + let(:pipeline) do + create(:ci_pipeline, project: project, + sha: project.commit.id) + end + let(:build) { create(:ci_build, pipeline: pipeline) } before do assign(:build, build) @@ -34,4 +38,15 @@ describe 'projects/builds/show' do expect(rendered).to have_link('Retry') end end + + describe 'commit title in sidebar' do + let(:commit_title) { project.commit.title } + + it 'shows commit title and not show commit message' do + render + + expect(rendered).to have_css('p.build-light-text.append-bottom-0', + text: /\A\n#{Regexp.escape(commit_title)}\n\Z/) + end + end end