Skip to content

Commit

Permalink
Also bump chromedriver version to match chrome version
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Sep 11, 2023
1 parent 57132f1 commit 91f3563
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
16 changes: 8 additions & 8 deletions common/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ exports_files(

http_archive(
name = "linux_chrome",
url = "https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5938.48/linux64/chrome-linux64.zip",
sha256 = "347711a3f694e0f8c6c6aa7edae14c55d555173080d2f1c3f4ffad4c12871c9d",
url = "https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.96/linux64/chrome-linux64.zip",
sha256 = "5d8ab1f999071b213d85e46ea4505d99df818b6fd0f8449e79710cb5403ba858",
build_file_content = """
filegroup(
name = "files",
Expand All @@ -89,8 +89,8 @@ exports_files(

http_archive(
name = "mac_chrome",
url = "https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5938.48/mac-x64/chrome-mac-x64.zip",
sha256 = "9a872c7c4b1df550773788e4894bcc7d6738cd7ef063a6138ea6ecd652c217d9",
url = "https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.96/mac-x64/chrome-mac-x64.zip",
sha256 = "edc8e78f7a4b618037067593b2cb79ff571c16da0b955bc05a500af34b77d2fe",
strip_prefix = "chrome-mac-x64",
patch_cmds = [
"mv 'Google Chrome for Testing.app' Chrome.app",
Expand All @@ -101,14 +101,14 @@ exports_files(

http_archive(
name = "linux_chromedriver",
url = "https://chromedriver.storage.googleapis.com/114.0.5735.90/chromedriver_linux64.zip",
sha256 = "a7787ef8b139170cab4abfca4a0284fd5d006bfd979624b4af25b64d583a6f44",
url = "https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.96/linux64/chromedriver-linux64.zip",
sha256 = "17d225af124f9483a5d79a547f28f34253d7a1ef603ab7fb5ee185c0e4c71535",
build_file_content = "exports_files([\"chromedriver\"])",
)

http_archive(
name = "mac_chromedriver",
url = "https://chromedriver.storage.googleapis.com/114.0.5735.90/chromedriver_mac64.zip",
sha256 = "6abdc9d358c2bc4668bef7b23048de2a9dbd3ad82cfbc6dfe322e74d4cff1650",
url = "https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.96/mac-x64/chromedriver-mac-x64.zip",
sha256 = "3ec691569dc8e98d803cf206c5fd4627e56836c81a5d1c9b7e5644a4e61ffd3f",
build_file_content = "exports_files([\"chromedriver\"])",
)
32 changes: 17 additions & 15 deletions scripts/pinned_browsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,25 @@ def get_chrome_milestone():
r = http.request('GET', f'https://chromiumdash.appspot.com/fetch_releases?channel={channel}&num=1&platform=Mac,Linux')
all_versions = json.loads(r.data)
# use the same milestone for all chrome releases, so pick the lowest
return min([version["milestone"] for version in all_versions if version["milestone"]])
milestone = min([version["milestone"] for version in all_versions if version["milestone"]])
r = http.request('GET', 'https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json')
versions = json.loads(r.data)["versions"]

def chromedriver():
r = http.request('GET', 'https://chromedriver.storage.googleapis.com/LATEST_RELEASE')
v = r.data.decode('utf-8')
return sorted(
filter(lambda v: v['version'].split('.')[0] == str(milestone), versions),
key=lambda v: LegacyVersion(v['version'])
)[-1]

def chromedriver():
content = ""

linux = 'https://chromedriver.storage.googleapis.com/%s/chromedriver_linux64.zip' % v
selected_version = get_chrome_milestone()

drivers = selected_version["downloads"]["chromedriver"]

linux = [d["url"] for d in drivers if d["platform"] == "linux64"][0]
sha = calculate_hash(linux)

content = content + """
http_archive(
name = "linux_chromedriver",
Expand All @@ -43,7 +52,7 @@ def chromedriver():
)
""" % (linux, sha)

mac = 'https://chromedriver.storage.googleapis.com/%s/chromedriver_mac64.zip' % v
mac = [d["url"] for d in drivers if d["platform"] == "mac-x64"][0]
sha = calculate_hash(mac)
content = content + """
http_archive(
Expand All @@ -53,18 +62,11 @@ def chromedriver():
build_file_content = "exports_files([\\"chromedriver\\"])",
)
""" % (mac, sha)

return content

def chrome():
milestone = get_chrome_milestone()

r = http.request('GET', 'https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json')
versions = json.loads(r.data)["versions"]

selected_version = sorted(
filter(lambda v: v['version'].split('.')[0] == str(milestone), versions),
key=lambda v: LegacyVersion(v['version'])
)[-1]
selected_version = get_chrome_milestone()

chrome_downloads = selected_version["downloads"]["chrome"]

Expand Down

0 comments on commit 91f3563

Please sign in to comment.