diff --git a/jenkins/scripts/zuul_swift_upload.py b/jenkins/scripts/zuul_swift_upload.py index 58321e04a7..9a7dedec9f 100755 --- a/jenkins/scripts/zuul_swift_upload.py +++ b/jenkins/scripts/zuul_swift_upload.py @@ -235,24 +235,7 @@ def build_file_list(file_path, logserver_prefix, swift_destination_prefix, folder_links.append(file_details) - for f in files: - filename = os.path.basename(f) - full_path = os.path.join(path, filename) - relative_name = os.path.relpath(full_path, parent_dir) - url = os.path.join(destination_prefix, relative_name) - - file_details = { - 'filename': filename, - 'path': full_path, - 'relative_name': relative_name, - 'url': url, - 'metadata': get_file_metadata(full_path), - } - - file_list.append(file_details) - folder_links.append(file_details) - - for f in folders: + for f in sorted(folders): filename = os.path.basename(f) + '/' full_path = os.path.join(path, filename) relative_name = os.path.relpath(full_path, parent_dir) @@ -269,6 +252,23 @@ def build_file_list(file_path, logserver_prefix, swift_destination_prefix, folder_links.append(file_details) + for f in sorted(files): + filename = os.path.basename(f) + full_path = os.path.join(path, filename) + relative_name = os.path.relpath(full_path, parent_dir) + url = os.path.join(destination_prefix, relative_name) + + file_details = { + 'filename': filename, + 'path': full_path, + 'relative_name': relative_name, + 'url': url, + 'metadata': get_file_metadata(full_path), + } + + file_list.append(file_details) + folder_links.append(file_details) + if create_dir_indexes: full_path = make_index_file( folder_links,