Class: Packages::Go::SyncPackagesWorker

Inherits:
Object
  • Object
show all
Includes:
ApplicationWorker, Gitlab::Golang
Defined in:
app/workers/packages/go/sync_packages_worker.rb

Constant Summary

Constants included from ApplicationWorker

ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT

Constants included from WorkerAttributes

WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES

Instance Method Summary collapse

Methods included from Gitlab::Golang

#go_path, #local_module_prefix, #package_url, #parse_pseudo_version, #parse_semver, #pkg_go_dev_url, #pseudo_version?, #semver_tag?, #validate_pseudo_version

Methods included from Gitlab::SidekiqVersioning::Worker

#job_version

Methods included from WorkerContext

#with_context

Instance Method Details

#perform(project_id, ref_name, path) ⇒ Object


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/workers/packages/go/sync_packages_worker.rb', line 19

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