diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 04:45:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 04:45:44 +0300 |
commit | 85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch) | |
tree | 9160f299afd8c80c038f08e1545be119f5e3f1e1 /app/workers/jira_connect | |
parent | 15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff) |
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'app/workers/jira_connect')
-rw-r--r-- | app/workers/jira_connect/sync_branch_worker.rb | 22 | ||||
-rw-r--r-- | app/workers/jira_connect/sync_merge_request_worker.rb | 18 |
2 files changed, 40 insertions, 0 deletions
diff --git a/app/workers/jira_connect/sync_branch_worker.rb b/app/workers/jira_connect/sync_branch_worker.rb new file mode 100644 index 00000000000..8c3416478fd --- /dev/null +++ b/app/workers/jira_connect/sync_branch_worker.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module JiraConnect + class SyncBranchWorker # rubocop:disable Scalability/IdempotentWorker + include ApplicationWorker + + queue_namespace :jira_connect + feature_category :integrations + loggable_arguments 1, 2 + + def perform(project_id, branch_name, commit_shas) + project = Project.find_by_id(project_id) + + return unless project + + branches = [project.repository.find_branch(branch_name)] if branch_name.present? + commits = project.commits_by(oids: commit_shas) if commit_shas.present? + + JiraConnect::SyncService.new(project).execute(commits: commits, branches: branches) + end + end +end diff --git a/app/workers/jira_connect/sync_merge_request_worker.rb b/app/workers/jira_connect/sync_merge_request_worker.rb new file mode 100644 index 00000000000..b78bb8dfe16 --- /dev/null +++ b/app/workers/jira_connect/sync_merge_request_worker.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module JiraConnect + class SyncMergeRequestWorker # rubocop:disable Scalability/IdempotentWorker + include ApplicationWorker + + queue_namespace :jira_connect + feature_category :integrations + + def perform(merge_request_id) + merge_request = MergeRequest.find_by_id(merge_request_id) + + return unless merge_request && merge_request.project + + JiraConnect::SyncService.new(merge_request.project).execute(merge_requests: [merge_request]) + end + end +end |