Skip to content

Commit 8cf8872

Browse files
Improve superpmi-asmdiffs AzDO pipeline robustness (#61819)
* Improve superpmi-asmdiffs AzDO pipeline robustness 1. When git fetching origin/main, use `--depth=500` to try to ensure there is enough context to allow finding a JIT change in the history. 2. Add some error checking in pipeline setup so failures in setting up the pipeline should fail the jobs early. * Remove unneeded `success` variable from jitrollingbuild.py
1 parent 4254fa3 commit 8cf8872

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

src/coreclr/scripts/jitrollingbuild.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,6 @@ def main(args):
750750
return 1
751751

752752
coreclr_args = setup_args(args)
753-
success = True
754753

755754
if coreclr_args.mode == "upload":
756755
upload_command(coreclr_args)
@@ -764,7 +763,8 @@ def main(args):
764763
else:
765764
raise NotImplementedError(coreclr_args.mode)
766765

767-
return 0 if success else 1
766+
# Note that if there is any failure, an exception is raised and the process exit code is then `1`
767+
return 0
768768

769769
################################################################################
770770
# __main__

src/coreclr/scripts/superpmi_asmdiffs_setup.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ def main(main_args):
115115
116116
Args:
117117
main_args ([type]): Arguments to the script
118+
119+
Returns:
120+
0 on success, otherwise a failure code
118121
"""
119122

120123
# Set up logging.
@@ -152,6 +155,7 @@ def main(main_args):
152155
git_exe_tool = os.path.join(git_directory, "cmd", "git.exe")
153156
if not os.path.isfile(git_exe_tool):
154157
print('Error: `git` not found at {}'.format(git_exe_tool))
158+
return 1
155159

156160
######## Get SuperPMI python scripts
157161

@@ -167,18 +171,22 @@ def main(main_args):
167171
os.makedirs(base_jit_directory)
168172

169173
print("Fetching history of `main` branch so we can find the baseline JIT")
170-
run_command(["git", "fetch", "origin", "main"], source_directory, _exit_on_fail=True)
174+
run_command(["git", "fetch", "--depth=500", "origin", "main"], source_directory, _exit_on_fail=True)
171175

172176
# Note: we only support downloading Windows versions of the JIT currently. To support downloading
173177
# non-Windows JITs on a Windows machine, pass `-host_os <os>` to jitrollingbuild.py.
174-
print("Running jitrollingbuild.py download to get baseline")
178+
print("Running jitrollingbuild.py download to get baseline JIT")
179+
jit_rolling_build_script = os.path.join(superpmi_scripts_directory, "jitrollingbuild.py")
175180
_, _, return_code = run_command([
176181
python_path,
177-
os.path.join(superpmi_scripts_directory, "jitrollingbuild.py"),
182+
jit_rolling_build_script,
178183
"download",
179184
"-arch", arch,
180185
"-target_dir", base_jit_directory],
181186
source_directory)
187+
if return_code != 0:
188+
print('{} failed with {}'.format(jit_rolling_build_script, return_code))
189+
return return_code
182190

183191
######## Get diff JIT
184192

@@ -238,6 +246,11 @@ def main(main_args):
238246
# Details: https://bugs.python.org/issue26660
239247
print('Ignoring PermissionError: {0}'.format(pe_error))
240248

249+
jit_analyze_tool = os.path.join(jit_analyze_build_directory, "jit-analyze.exe")
250+
if not os.path.isfile(jit_analyze_tool):
251+
print('Error: {} not found'.format(jit_analyze_tool))
252+
return 1
253+
241254
######## Set pipeline variables
242255

243256
helix_source_prefix = "official"
@@ -249,6 +262,8 @@ def main(main_args):
249262
set_pipeline_variable("Creator", creator)
250263
set_pipeline_variable("HelixSourcePrefix", helix_source_prefix)
251264

265+
return 0
266+
252267

253268
if __name__ == "__main__":
254269
args = parser.parse_args()

0 commit comments

Comments
 (0)