diff options
Diffstat (limited to 'app/models/ci/build_trace_chunks/fog.rb')
-rw-r--r-- | app/models/ci/build_trace_chunks/fog.rb | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/app/models/ci/build_trace_chunks/fog.rb b/app/models/ci/build_trace_chunks/fog.rb index b1e9fd1faeb..d3051e3dadc 100644 --- a/app/models/ci/build_trace_chunks/fog.rb +++ b/app/models/ci/build_trace_chunks/fog.rb @@ -8,13 +8,17 @@ module Ci end def data(model) - connection.get_object(bucket_name, key(model))[:body] + files.get(key(model))&.body rescue Excon::Error::NotFound # If the object does not exist in the object storage, this method returns nil. end def set_data(model, new_data) - connection.put_object(bucket_name, key(model), new_data) + # TODO: Support AWS S3 server side encryption + files.create({ + key: key(model), + body: new_data + }) end def append_data(model, new_data, offset) @@ -43,7 +47,7 @@ module Ci def delete_keys(keys) keys.each do |key| - connection.delete_object(bucket_name, key_raw(*key)) + files.destroy(key_raw(*key)) end end @@ -69,6 +73,14 @@ module Ci @connection ||= ::Fog::Storage.new(object_store.connection.to_hash.deep_symbolize_keys) end + def fog_directory + @fog_directory ||= connection.directories.new(key: bucket_name) + end + + def files + @files ||= fog_directory.files + end + def object_store Gitlab.config.artifacts.object_store end |