Commit 592b0107 authored by Tiffany Rea's avatar Tiffany Rea

Merge branch 'fix-download-when-dir-not-exist' into 'master'

Fix download job when dir not exist

See merge request gitlab-org/gitlab!83991
parents 75814e62 4c145dbf
......@@ -75,13 +75,16 @@ 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}"
Runtime::Logger.info("Downloading #{file_name} to #{local_path}")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment