summaryrefslogtreecommitdiff
path: root/qa/qa/tools/test_resources_handler.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/tools/test_resources_handler.rb')
-rw-r--r--qa/qa/tools/test_resources_handler.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/qa/qa/tools/test_resources_handler.rb b/qa/qa/tools/test_resources_handler.rb
index 476f87fff6b..5218e6df217 100644
--- a/qa/qa/tools/test_resources_handler.rb
+++ b/qa/qa/tools/test_resources_handler.rb
@@ -75,11 +75,15 @@ module QA
# Download files from GCS bucket by environment name
# Delete the files afterward
def download(ci_project_name)
- files_list = gcs_storage.list_objects(BUCKET, prefix: ci_project_name).items.each_with_object([]) do |obj, arr|
+ bucket_items = gcs_storage.list_objects(BUCKET, prefix: ci_project_name).items
+
+ files_list = bucket_items&.each_with_object([]) do |obj, arr|
arr << obj.name
end
- return puts "\nNothing to download!" if files_list.empty?
+ return puts "\nNothing to download!" if files_list.blank?
+
+ FileUtils.mkdir_p('tmp/')
files_list.each do |file_name|
local_path = "tmp/#{file_name.split('/').last}"