Skip to content

Fix workhorse temp path for namespace uploads

Jarka Košanová requested to merge fix-namespace-upload into master

What does this MR do?

The temp workhorse path was changed to be same as for projects. It needs to be changed because upload to the original location is not permitted by the workhorse (as can be seen in the error bellow).

Because now we use a different root for project and namespace uploads also the workhorse temp path differs.

For projects it is public/uploads/tmp/uploads which is fine but for namespaces it is public/tmp/uploads - which is not writable by workhorse.

This is only a temp fix, we need to unify the final path with FileUploader so that we store files on the same location. Because it will also include migration of old files to the new location and we need to have the fix ready soon we are fixing it this way for now.

Tested using GitLab EE docker image

Before the change (~/gitlab/logs/gitlab-workhorse/current) 2018-09-10_16:55:21.42636 time="2018-09-10T16:55:21Z" level=error msg=error correlation-id=7eaEYoEfaH8 error="handleFileUploads: extract files from multipart: Persisting multipart file: uploadLocalFile: mkdir \"/opt/gitlab/embedded/service/gitlab-rails/public/tmp/uploads\": mkdir /opt/gitlab/embedded/service/gitlab-rails/public/tmp: permission denied" method=POST uri=/groups/test_group/-/uploads

After the change everything's working (temp file location: @tempfile=#<File:/var/opt/gitlab/gitlab-rails/uploads/tmp/uploads/DSC01144.jpg508443030>>).

Old files are not affected, this path is used only for uploads.

Follow-up issue: https://gitlab.com/gitlab-org/gitlab-ee/issues/7530

What are the relevant issue numbers?

Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/7009

Does this MR meet the acceptance criteria?

Edited by Jarka Košanová

Merge request reports