diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-24 15:09:32 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-24 15:09:32 +0300 |
commit | a46b489e175708cc64fc5198f458f927558f11ba (patch) | |
tree | 96bb3be8fa37d729d1417b4e91df0bf718039911 /app/workers | |
parent | bd818d0618b0c1316c23f47f9ae41449e5d41fa8 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/all_queues.yml | 8 | ||||
-rw-r--r-- | app/workers/packages/go/sync_packages_worker.rb | 33 |
2 files changed, 41 insertions, 0 deletions
diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index d405b00dc32..3dbb087d8d8 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -1083,6 +1083,14 @@ :weight: 1 :idempotent: :tags: [] +- :name: package_repositories:packages_go_sync_packages + :feature_category: :package_registry + :has_external_dependencies: + :urgency: :low + :resource_boundary: :unknown + :weight: 1 + :idempotent: true + :tags: [] - :name: package_repositories:packages_maven_metadata_sync :feature_category: :package_registry :has_external_dependencies: diff --git a/app/workers/packages/go/sync_packages_worker.rb b/app/workers/packages/go/sync_packages_worker.rb new file mode 100644 index 00000000000..e41f27f2252 --- /dev/null +++ b/app/workers/packages/go/sync_packages_worker.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module Packages + module Go + class SyncPackagesWorker + include ApplicationWorker + include Gitlab::Golang + + queue_namespace :package_repositories + feature_category :package_registry + + deduplicate :until_executing + idempotent! + + def perform(project_id, ref_name, path) + project = Project.find_by_id(project_id) + return unless project && project.repository.find_tag(ref_name) + + module_name = go_path(project, path) + mod = Packages::Go::ModuleFinder.new(project, module_name).execute + return unless mod + + ver = Packages::Go::VersionFinder.new(mod).find(ref_name) + return unless ver + + Packages::Go::CreatePackageService.new(project, nil, version: ver).execute + + rescue ::Packages::Go::CreatePackageService::GoZipSizeError => ex + Gitlab::ErrorTracking.log_exception(ex) + end + end + end +end |