Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-21 03:06:02 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-21 03:06:02 +0300
commit96f3246b9ca41d27d1e268ac3fc90326ad0714ba (patch)
tree2b0e7426d4aae6dd7461ccdb4c5be315313254ab /lib/backup
parent2477ab5553eabc6c4579cb23aba620ffc8cba228 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/backup')
-rw-r--r--lib/backup/manager.rb28
1 files changed, 23 insertions, 5 deletions
diff --git a/lib/backup/manager.rb b/lib/backup/manager.rb
index ce0c4c5d974..cb1f2fdcd17 100644
--- a/lib/backup/manager.rb
+++ b/lib/backup/manager.rb
@@ -47,11 +47,7 @@ module Backup
directory = connect_to_remote_directory(connection_settings)
- if directory.files.create(key: remote_target, body: File.open(tar_file), public: false,
- multipart_chunk_size: Gitlab.config.backup.upload.multipart_chunk_size,
- encryption: Gitlab.config.backup.upload.encryption,
- encryption_key: Gitlab.config.backup.upload.encryption_key,
- storage_class: Gitlab.config.backup.upload.storage_class)
+ if directory.files.create(create_attributes)
progress.puts "done".color(:green)
else
puts "uploading backup to #{remote_directory} failed".color(:red)
@@ -252,5 +248,27 @@ module Backup
skipped: ENV["SKIP"]
}
end
+
+ def create_attributes
+ attrs = {
+ key: remote_target,
+ body: File.open(tar_file),
+ multipart_chunk_size: Gitlab.config.backup.upload.multipart_chunk_size,
+ encryption: Gitlab.config.backup.upload.encryption,
+ encryption_key: Gitlab.config.backup.upload.encryption_key,
+ storage_class: Gitlab.config.backup.upload.storage_class
+ }
+
+ # Google bucket-only policies prevent setting an ACL. In any case, by default,
+ # all objects are set to the default ACL, which is project-private:
+ # https://cloud.google.com/storage/docs/json_api/v1/defaultObjectAccessControls
+ attrs[:public] = false unless google_provider?
+
+ attrs
+ end
+
+ def google_provider?
+ Gitlab.config.backup.upload.connection&.provider&.downcase == 'google'
+ end
end
end