Commit 2dd33c08 authored by Sean McGivern's avatar Sean McGivern

Merge branch '9643-jira-api-serializer-ce' into 'master'

[CE] Create serializer for Jira API JSON payload

See merge request gitlab-org/gitlab-ce!31139
parents cb41470c d19717cb
...@@ -31,7 +31,7 @@ class JiraService < IssueTrackerService ...@@ -31,7 +31,7 @@ class JiraService < IssueTrackerService
# {PROJECT-KEY}-{NUMBER} Examples: JIRA-1, PROJECT-1 # {PROJECT-KEY}-{NUMBER} Examples: JIRA-1, PROJECT-1
def self.reference_pattern(only_long: true) def self.reference_pattern(only_long: true)
@reference_pattern ||= /(?<issue>\b([A-Z][A-Z0-9_]+-)\d+)/ @reference_pattern ||= /(?<issue>\b#{Gitlab::Regex.jira_issue_key_regex})/
end end
def initialize_properties def initialize_properties
......
...@@ -94,6 +94,12 @@ module Gitlab ...@@ -94,6 +94,12 @@ module Gitlab
}mx }mx
end end
# Based on Jira's project key format
# https://confluence.atlassian.com/adminjiraserver073/changing-the-project-key-format-861253229.html
def jira_issue_key_regex
@jira_issue_key_regex ||= /[A-Z][A-Z_0-9]+-\d+/
end
def jira_transition_id_regex def jira_transition_id_regex
@jira_transition_id_regex ||= /\d+/ @jira_transition_id_regex ||= /\d+/
end end
......
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