Update ImportExportUploader workhorse_local_upload_path
What does this MR do?
Currently Group Import API does not work on packaged installations due to ImportExportUploader.workhorse_local_upload_path
returning /public/tmp/uploads
directory to workhorse, when uploading a Group Export archive.
==> /var/log/gitlab/gitlab-workhorse/current <==
{"correlation_id":"hrkzWeU67Y5","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","level":"error","method":"POST","msg":"error","time":"2020-02-21T10:24:15Z","uri":"/api/v4/groups/import"}
{"correlation_id":"hrkzWeU67Y5","duration_ms":67,"host":"localhost","level":"info","method":"POST","msg":"access","proto":"HTTP/1.1","referrer":"","remote_addr":"127.0.0.1:0","remote_ip":"127.0.0.1","status":500,"system":"http","time":"2020-02-21T10:24:15Z","uri":"/api/v4/groups/import","user_agent":"curl/7.64.1","written_bytes":22}
When workhorse tries to create such directory, it fails, because of lacking permissions. git
user that is used there does not have any write permissions in this directory except to uploads
dir, which is a symlink to a gitlab/uploads
folder.
We should be uploading tmp file uploads to /public/uploads/tmp/uploads
instead.
This MR changes workhorse_local_upload_path
to include uploads
in the returned path. This is similar to what FileUploader
has for it's workhorse local upload path.
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team