summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG1
-rw-r--r--app/models/ci/pipeline.rb4
-rw-r--r--app/views/projects/builds/_sidebar.html.haml4
-rw-r--r--spec/views/projects/builds/show.html.haml_spec.rb19
4 files changed, 24 insertions, 4 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 39651675e79..7bc020c8d68 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 b468434866b..a65a826536d 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 cab21f0cf19..396cc4ad925 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 cd18d19ef5e..42220a20c75 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