Skip to content

ArtifactUploader copies files across filesystems

ZD: https://gitlab.zendesk.com/agent/tickets/80838

We have a bug similar to gitlab-org/gitlab-ce#33218 where artifacts are being copied to /var/opt/gitlab/gitlab-rails/tmp before copied to their final destination. I suspect it was introduced in 9.4 with the refactor of ArtifactUploader to ObjectStoreUploader. This appears to be happening:

  1. Workhorse saves the file to something like /var/opt/gitlab/gitlab-rails/shared/artifacts/tmp/uploads/multipart-846747258/artifacts.zip
  2. CarrierWave then copies the files to a temporary dir in /opt/gitlab/embedded/service/gitlab-rails/tmp/1501626847-11955-0001-0912/artifacts.zip (see https://github.com/carrierwaveuploader/carrierwave/blob/v1.1.0/lib/carrierwave/uploader/cache.rb#L134)
  3. CarrierWave then saves the final destination to /var/opt/gitlab/gitlab-rails/shared/artifacts/2017_08/113/1279/artifacts.zip

I think we want to do the following:

  • Enable CarrierWave cache so that the file is moved, not copied
  • Extract the workfile_path method from GitlabUploader into ObjectStoreUploader

/cc: @zj, @ayufan, @dblessing

Edited by Stan Hu