Commit 09117ea5 authored by Andy Soiron's avatar Andy Soiron

Merge branch 'andysoiron/add-jira-connect-mr-description-issue-id-scan-for-builds' into 'master'

Scan MR description for Jira issue keys when syncing builds with Jira

See merge request gitlab-org/gitlab!82204
parents 1863562b 9db551e8
......@@ -26,7 +26,7 @@ module Atlassian
# merge request title.
@issue_keys ||= begin
pipeline.all_merge_requests.flat_map do |mr|
src = "#{mr.source_branch} #{mr.title}"
src = "#{mr.source_branch} #{mr.title} #{mr.description}"
JiraIssueKeyExtractor.new(src).issue_keys
end.uniq
end
......
......@@ -33,6 +33,10 @@ FactoryBot.define do
title { generate(:jira_title) }
end
trait :jira_description do
description { generate(:jira_description) }
end
trait :jira_branch do
source_branch { generate(:jira_branch) }
end
......
......@@ -18,6 +18,7 @@ FactoryBot.define do
sequence(:draft_title) { |n| "Draft: #{n}" }
sequence(:wip_title) { |n| "WIP: #{n}" }
sequence(:jira_title) { |n| "[PROJ-#{n}]: fix bug" }
sequence(:jira_description) { |n| "This is a description\n here is the description\n Related to: PROJ-#{n}" }
sequence(:jira_branch) { |n| "feature/PROJ-#{n}" }
sequence(:job_name) { |n| "job #{n}" }
sequence(:work_item_type_name) { |n| "bug#{n}" }
......
......@@ -31,7 +31,7 @@ RSpec.describe Atlassian::JiraConnect::Serializers::BuildEntity do
context 'when the pipeline does belong to a Jira issue' do
let(:pipeline) { create(:ci_pipeline, merge_request: merge_request) }
%i[jira_branch jira_title].each do |trait|
%i[jira_branch jira_title jira_description].each do |trait|
context "because it belongs to an MR with a #{trait}" do
let(:merge_request) { create(:merge_request, trait) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment