summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-27 12:07:43 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-27 12:07:43 +0000
commit39fa7d1eeb2dba52f0601128f3ac91f57d19866e (patch)
treeda042d34ff762dd1957e51666a34202295a081b9 /lib
parent6ac4a6713ed3196af899011f7e18658e16ebaac0 (diff)
downloadgitlab-ce-39fa7d1eeb2dba52f0601128f3ac91f57d19866e.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/import_formatter.rb5
-rw-r--r--lib/gitlab/jira_import/issue_serializer.rb42
-rw-r--r--lib/gitlab/usage_data_counters/base_counter.rb4
-rw-r--r--lib/system_check/app/git_config_check.rb2
-rw-r--r--lib/system_check/app/gitlab_config_exists_check.rb2
-rw-r--r--lib/system_check/app/gitlab_config_up_to_date_check.rb2
-rw-r--r--lib/system_check/app/init_script_exists_check.rb2
-rw-r--r--lib/system_check/app/init_script_up_to_date_check.rb2
-rw-r--r--lib/system_check/app/log_writable_check.rb2
-rw-r--r--lib/system_check/app/tmp_writable_check.rb2
-rw-r--r--lib/system_check/app/uploads_directory_exists_check.rb2
-rw-r--r--lib/system_check/app/uploads_path_permission_check.rb2
-rw-r--r--lib/system_check/app/uploads_path_tmp_permission_check.rb2
13 files changed, 57 insertions, 14 deletions
diff --git a/lib/gitlab/import_formatter.rb b/lib/gitlab/import_formatter.rb
index d4ba4d1181d..b272adf8166 100644
--- a/lib/gitlab/import_formatter.rb
+++ b/lib/gitlab/import_formatter.rb
@@ -14,5 +14,10 @@ module Gitlab
author ||= "Anonymous"
"*Created by: #{author}*\n\n"
end
+
+ def assignee_line(assignee)
+ assignee ||= "Anonymous"
+ "*Assigned to: #{assignee}*\n\n"
+ end
end
end
diff --git a/lib/gitlab/jira_import/issue_serializer.rb b/lib/gitlab/jira_import/issue_serializer.rb
index f00852a21a2..0be5d22065a 100644
--- a/lib/gitlab/jira_import/issue_serializer.rb
+++ b/lib/gitlab/jira_import/issue_serializer.rb
@@ -3,12 +3,50 @@
module Gitlab
module JiraImport
class IssueSerializer
+ attr_reader :jira_issue, :project, :params, :formatter
+
def initialize(project, jira_issue, params = {})
+ @jira_issue = jira_issue
+ @project = project
+ @params = params
+ @formatter = Gitlab::ImportFormatter.new
end
def execute
- # this is going to be implemented in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/27201
- {}
+ {
+ iid: params[:iid],
+ project_id: project.id,
+ description: description,
+ title: title,
+ state_id: map_status(jira_issue.status.statusCategory),
+ updated_at: jira_issue.updated,
+ created_at: jira_issue.created,
+ author_id: project.creator_id # TODO: map actual author: https://gitlab.com/gitlab-org/gitlab/-/issues/210580
+ }
+ end
+
+ private
+
+ def title
+ "[#{jira_issue.key}] #{jira_issue.summary}"
+ end
+
+ def description
+ body = []
+ body << formatter.author_line(jira_issue.reporter.displayName)
+ body << formatter.assignee_line(jira_issue.assignee.displayName) if jira_issue.assignee
+ body << jira_issue.description
+
+ body.join
+ end
+
+ def map_status(jira_status_category)
+ case jira_status_category["key"].downcase
+ when 'done'
+ Issuable::STATE_ID_MAP[:closed]
+ else
+ Issuable::STATE_ID_MAP[:opened]
+ end
end
end
end
diff --git a/lib/gitlab/usage_data_counters/base_counter.rb b/lib/gitlab/usage_data_counters/base_counter.rb
index 77fc216738f..33111b46381 100644
--- a/lib/gitlab/usage_data_counters/base_counter.rb
+++ b/lib/gitlab/usage_data_counters/base_counter.rb
@@ -14,11 +14,11 @@ module Gitlab::UsageDataCounters
end
def count(event)
- increment(redis_key event)
+ increment(redis_key(event))
end
def read(event)
- total_count(redis_key event)
+ total_count(redis_key(event))
end
def totals
diff --git a/lib/system_check/app/git_config_check.rb b/lib/system_check/app/git_config_check.rb
index 4e8d607096c..d0b64b8bfeb 100644
--- a/lib/system_check/app/git_config_check.rb
+++ b/lib/system_check/app/git_config_check.rb
@@ -36,7 +36,7 @@ module SystemCheck
sudo_gitlab("\"#{Gitlab.config.git.bin_path}\" config --global core.autocrlf \"#{OPTIONS['core.autocrlf']}\"")
)
for_more_information(
- see_installation_guide_section 'GitLab'
+ see_installation_guide_section('GitLab')
)
end
end
diff --git a/lib/system_check/app/gitlab_config_exists_check.rb b/lib/system_check/app/gitlab_config_exists_check.rb
index 1cc5ead0d89..a05aab1a5d2 100644
--- a/lib/system_check/app/gitlab_config_exists_check.rb
+++ b/lib/system_check/app/gitlab_config_exists_check.rb
@@ -17,7 +17,7 @@ module SystemCheck
'Update config/gitlab.yml to match your setup'
)
for_more_information(
- see_installation_guide_section 'GitLab'
+ see_installation_guide_section('GitLab')
)
fix_and_rerun
end
diff --git a/lib/system_check/app/gitlab_config_up_to_date_check.rb b/lib/system_check/app/gitlab_config_up_to_date_check.rb
index 58c7e3039c8..193d9b77e5b 100644
--- a/lib/system_check/app/gitlab_config_up_to_date_check.rb
+++ b/lib/system_check/app/gitlab_config_up_to_date_check.rb
@@ -23,7 +23,7 @@ module SystemCheck
'Update config/gitlab.yml to match your setup'
)
for_more_information(
- see_installation_guide_section 'GitLab'
+ see_installation_guide_section('GitLab')
)
fix_and_rerun
end
diff --git a/lib/system_check/app/init_script_exists_check.rb b/lib/system_check/app/init_script_exists_check.rb
index d36dbe7d67d..7be92acdc37 100644
--- a/lib/system_check/app/init_script_exists_check.rb
+++ b/lib/system_check/app/init_script_exists_check.rb
@@ -20,7 +20,7 @@ module SystemCheck
'Install the init script'
)
for_more_information(
- see_installation_guide_section 'Install Init Script'
+ see_installation_guide_section('Install Init Script')
)
fix_and_rerun
end
diff --git a/lib/system_check/app/init_script_up_to_date_check.rb b/lib/system_check/app/init_script_up_to_date_check.rb
index 7e2e168af8b..cf841d5e659 100644
--- a/lib/system_check/app/init_script_up_to_date_check.rb
+++ b/lib/system_check/app/init_script_up_to_date_check.rb
@@ -32,7 +32,7 @@ module SystemCheck
'Re-download the init script'
)
for_more_information(
- see_installation_guide_section 'Install Init Script'
+ see_installation_guide_section('Install Init Script')
)
fix_and_rerun
end
diff --git a/lib/system_check/app/log_writable_check.rb b/lib/system_check/app/log_writable_check.rb
index e26ad143eb8..2c108f0c18d 100644
--- a/lib/system_check/app/log_writable_check.rb
+++ b/lib/system_check/app/log_writable_check.rb
@@ -15,7 +15,7 @@ module SystemCheck
"sudo chmod -R u+rwX #{log_path}"
)
for_more_information(
- see_installation_guide_section 'GitLab'
+ see_installation_guide_section('GitLab')
)
fix_and_rerun
end
diff --git a/lib/system_check/app/tmp_writable_check.rb b/lib/system_check/app/tmp_writable_check.rb
index 6687df091d3..937a5e1345f 100644
--- a/lib/system_check/app/tmp_writable_check.rb
+++ b/lib/system_check/app/tmp_writable_check.rb
@@ -15,7 +15,7 @@ module SystemCheck
"sudo chmod -R u+rwX #{tmp_path}"
)
for_more_information(
- see_installation_guide_section 'GitLab'
+ see_installation_guide_section('GitLab')
)
fix_and_rerun
end
diff --git a/lib/system_check/app/uploads_directory_exists_check.rb b/lib/system_check/app/uploads_directory_exists_check.rb
index 940eff9d4cf..54dff63ab61 100644
--- a/lib/system_check/app/uploads_directory_exists_check.rb
+++ b/lib/system_check/app/uploads_directory_exists_check.rb
@@ -14,7 +14,7 @@ module SystemCheck
"sudo -u #{gitlab_user} mkdir #{Rails.root}/public/uploads"
)
for_more_information(
- see_installation_guide_section 'GitLab'
+ see_installation_guide_section('GitLab')
)
fix_and_rerun
end
diff --git a/lib/system_check/app/uploads_path_permission_check.rb b/lib/system_check/app/uploads_path_permission_check.rb
index 4a49f3bc2bb..2e1cc687c43 100644
--- a/lib/system_check/app/uploads_path_permission_check.rb
+++ b/lib/system_check/app/uploads_path_permission_check.rb
@@ -19,7 +19,7 @@ module SystemCheck
"sudo chmod 700 #{uploads_fullpath}"
)
for_more_information(
- see_installation_guide_section 'GitLab'
+ see_installation_guide_section('GitLab')
)
fix_and_rerun
end
diff --git a/lib/system_check/app/uploads_path_tmp_permission_check.rb b/lib/system_check/app/uploads_path_tmp_permission_check.rb
index ae374f4707c..567c7540777 100644
--- a/lib/system_check/app/uploads_path_tmp_permission_check.rb
+++ b/lib/system_check/app/uploads_path_tmp_permission_check.rb
@@ -23,7 +23,7 @@ module SystemCheck
"sudo find #{uploads_fullpath} -type d -not -path #{uploads_fullpath} -exec chmod 0700 {} \\;"
)
for_more_information(
- see_installation_guide_section 'GitLab'
+ see_installation_guide_section('GitLab')
)
fix_and_rerun
end