diff --git a/src/coreclr/scripts/superpmi_asmdiffs.py b/src/coreclr/scripts/superpmi_asmdiffs.py index ffd1fd9424b2df..8a30850e7282f5 100644 --- a/src/coreclr/scripts/superpmi_asmdiffs.py +++ b/src/coreclr/scripts/superpmi_asmdiffs.py @@ -81,6 +81,7 @@ def copy_dasm_files(spmi_location, upload_directory, tag_name): if not os.path.isdir(upload_directory): os.makedirs(upload_directory) + dasm_file_present = False # Create temp directory to copy all issues to upload. We don't want to create a sub-folder # inside issues_directory because that will also get included twice. with TempDir() as prep_directory: @@ -98,9 +99,18 @@ def copy_dasm_files(spmi_location, upload_directory, tag_name): os.makedirs(dst_directory) try: shutil.copy2(dasm_src_file, dasm_dst_file) + dasm_file_present = True except PermissionError as pe_error: print('Ignoring PermissionError: {0}'.format(pe_error)) + # If there are no diffs, create an zip file with single file in it. + # Otherwise, Azdo considers it as failed job. + # See https://github.com/dotnet/arcade/issues/8200 + if not dasm_file_present: + no_diff = os.path.join(prep_directory, "nodiff.txt") + with open(no_diff, "w") as no_diff_file: + no_diff_file.write("No diffs found!") + # Zip compress the files we will upload zip_path = os.path.join(prep_directory, "Asmdiffs_" + tag_name) print("Creating archive: " + zip_path)