Skip to content

Commit

Permalink
Improve superpmi-asmdiffs AzDO pipeline robustness (#61819)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
BruceForstall committed Nov 19, 2021
1 parent 4254fa3 commit 8cf8872
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/coreclr/scripts/jitrollingbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,6 @@ def main(args):
return 1

coreclr_args = setup_args(args)
success = True

if coreclr_args.mode == "upload":
upload_command(coreclr_args)
Expand All @@ -764,7 +763,8 @@ def main(args):
else:
raise NotImplementedError(coreclr_args.mode)

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

################################################################################
# __main__
Expand Down
21 changes: 18 additions & 3 deletions src/coreclr/scripts/superpmi_asmdiffs_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ def main(main_args):
Args:
main_args ([type]): Arguments to the script
Returns:
0 on success, otherwise a failure code
"""

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

######## Get SuperPMI python scripts

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

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

# Note: we only support downloading Windows versions of the JIT currently. To support downloading
# non-Windows JITs on a Windows machine, pass `-host_os <os>` to jitrollingbuild.py.
print("Running jitrollingbuild.py download to get baseline")
print("Running jitrollingbuild.py download to get baseline JIT")
jit_rolling_build_script = os.path.join(superpmi_scripts_directory, "jitrollingbuild.py")
_, _, return_code = run_command([
python_path,
os.path.join(superpmi_scripts_directory, "jitrollingbuild.py"),
jit_rolling_build_script,
"download",
"-arch", arch,
"-target_dir", base_jit_directory],
source_directory)
if return_code != 0:
print('{} failed with {}'.format(jit_rolling_build_script, return_code))
return return_code

######## Get diff JIT

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

jit_analyze_tool = os.path.join(jit_analyze_build_directory, "jit-analyze.exe")
if not os.path.isfile(jit_analyze_tool):
print('Error: {} not found'.format(jit_analyze_tool))
return 1

######## Set pipeline variables

helix_source_prefix = "official"
Expand All @@ -249,6 +262,8 @@ def main(main_args):
set_pipeline_variable("Creator", creator)
set_pipeline_variable("HelixSourcePrefix", helix_source_prefix)

return 0


if __name__ == "__main__":
args = parser.parse_args()
Expand Down

0 comments on commit 8cf8872

Please sign in to comment.