[ci/release] Re-enable commit sanity check (#23327)

Commit sanity checks are currently seemingly disabled. This PR re-enables them by parsing wheel URLs.
This commit is contained in:
Kai Fricke 2022-03-18 12:57:41 +00:00 committed by GitHub
parent b1cda46681
commit 3cf8116df2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 0 deletions

View file

@ -2,6 +2,7 @@ import copy
import datetime
import json
import os
import re
from typing import Dict, List, Optional
import jinja2
@ -194,6 +195,12 @@ def load_test_cluster_env(test: Test, ray_wheels_url: str) -> Optional[Dict]:
env = get_test_environment()
commit = env.get("RAY_COMMIT", None)
if not commit:
match = re.search(r"/([a-f0-9]{40})/", ray_wheels_url)
if match:
commit = match.group(1)
env["RAY_WHEELS_SANITY_CHECK"] = get_wheels_sanity_check(commit)
env["RAY_WHEELS"] = ray_wheels_url

View file

@ -6,6 +6,7 @@ from unittest.mock import patch
from freezegun import freeze_time
from ray_release.config import Test, load_test_cluster_env
from ray_release.exception import RayWheelsNotFoundError, RayWheelsTimeoutError
from ray_release.wheels import (
get_ray_version,
@ -174,6 +175,28 @@ class WheelsFinderTest(unittest.TestCase):
self.assertEqual(url, get_ray_wheels_url(repo, branch, commit, version))
def testWheelsSanityString(self):
this_env = {"env": None}
def override_env(path, env):
this_env["env"] = env
with patch("ray_release.config.load_and_render_yaml_template", override_env):
load_test_cluster_env(
Test(cluster=dict(cluster_env="invalid")),
ray_wheels_url="https://no-commit-url",
)
assert (
"No commit sanity check" in this_env["env"]["RAY_WHEELS_SANITY_CHECK"]
)
sha = "abcdef1234abcdef1234abcdef1234abcdef1234"
load_test_cluster_env(
Test(cluster=dict(cluster_env="invalid")),
ray_wheels_url=f"https://some/{sha}/binary.whl",
)
assert sha in this_env["env"]["RAY_WHEELS_SANITY_CHECK"]
if __name__ == "__main__":
import pytest