Skip to content

Commit 8e5b869

Browse files
committed
Pinned browsers script automatically generates beta chrome
1 parent 7babc22 commit 8e5b869

File tree

2 files changed

+75
-90
lines changed

2 files changed

+75
-90
lines changed

common/repositories.bzl

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ def pin_browsers():
1111

1212
http_archive(
1313
name = "linux_firefox",
14-
url = "https://ftp.mozilla.org/pub/firefox/releases/138.0.4/linux-x86_64/en-US/firefox-138.0.4.tar.xz",
15-
sha256 = "c27d5bf7483eda49aae544d9f8b4f064dbc7341b27d7098378108e52071bf947",
14+
url = "https://ftp.mozilla.org/pub/firefox/releases/139.0.1/linux-x86_64/en-US/firefox-139.0.1.tar.xz",
15+
sha256 = "f1a264f61d41700e8fcfa2310478d0c909655399a413072664fddaf612b53c07",
1616
build_file_content = """
1717
load("@aspect_rules_js//js:defs.bzl", "js_library")
1818
package(default_visibility = ["//visibility:public"])
@@ -33,8 +33,8 @@ js_library(
3333

3434
dmg_archive(
3535
name = "mac_firefox",
36-
url = "https://ftp.mozilla.org/pub/firefox/releases/138.0.4/mac/en-US/Firefox%20138.0.4.dmg",
37-
sha256 = "6842663f38b8b12b08b67239f0cc2118e93fa0b5b57e856c21f384fb501fb430",
36+
url = "https://ftp.mozilla.org/pub/firefox/releases/139.0.1/mac/en-US/Firefox%20139.0.1.dmg",
37+
sha256 = "243478e2a2fd5d9dd0cc261c812b0146e433d703fec960c27c7284b2de7e65bc",
3838
build_file_content = """
3939
load("@aspect_rules_js//js:defs.bzl", "js_library")
4040
package(default_visibility = ["//visibility:public"])
@@ -50,8 +50,8 @@ js_library(
5050

5151
http_archive(
5252
name = "linux_beta_firefox",
53-
url = "https://ftp.mozilla.org/pub/firefox/releases/139.0b10/linux-x86_64/en-US/firefox-139.0b10.tar.xz",
54-
sha256 = "c369df6474ffdece0eff47e8750d52ed7663bf1ecee88d9a19f70b3e2b206cf8",
53+
url = "https://ftp.mozilla.org/pub/firefox/releases/140.0b2/linux-x86_64/en-US/firefox-140.0b2.tar.xz",
54+
sha256 = "828cac8a8d7e83fd82c13c979fce4a77262be2d8bf6639612664ca1f10c96ec1",
5555
build_file_content = """
5656
load("@aspect_rules_js//js:defs.bzl", "js_library")
5757
package(default_visibility = ["//visibility:public"])
@@ -72,8 +72,8 @@ js_library(
7272

7373
dmg_archive(
7474
name = "mac_beta_firefox",
75-
url = "https://ftp.mozilla.org/pub/firefox/releases/139.0b10/mac/en-US/Firefox%20139.0b10.dmg",
76-
sha256 = "48bc5bf417013e457a6f3437271cbeee6bd67a0a8381bbd7deb198dc9caa3057",
75+
url = "https://ftp.mozilla.org/pub/firefox/releases/140.0b2/mac/en-US/Firefox%20140.0b2.dmg",
76+
sha256 = "e60b906321e4e8f6479d87e02314fdf804e3b461028f8d70552d88911a693a0e",
7777
build_file_content = """
7878
load("@aspect_rules_js//js:defs.bzl", "js_library")
7979
package(default_visibility = ["//visibility:public"])
@@ -123,10 +123,10 @@ js_library(
123123

124124
pkg_archive(
125125
name = "mac_edge",
126-
url = "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/8b523c53-9ba6-4310-b0d3-9391eaf174f7/MicrosoftEdge-136.0.3240.76.pkg",
127-
sha256 = "6843377514a8ab215423998e039dcf95ec240300ed12e19f2244fd7bf77a68f1",
126+
url = "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/a79f2827-2aae-47ec-b8ac-cbacd67e057a/MicrosoftEdge-137.0.3296.52.pkg",
127+
sha256 = "08d29e9b89d2b2789bab08c70530226a7bd700835a35b5fb2f458a06d057765d",
128128
move = {
129-
"MicrosoftEdge-136.0.3240.76.pkg/Payload/Microsoft Edge.app": "Edge.app",
129+
"MicrosoftEdge-137.0.3296.52.pkg/Payload/Microsoft Edge.app": "Edge.app",
130130
},
131131
build_file_content = """
132132
load("@aspect_rules_js//js:defs.bzl", "js_library")
@@ -143,8 +143,8 @@ js_library(
143143

144144
deb_archive(
145145
name = "linux_edge",
146-
url = "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_136.0.3240.76-1_amd64.deb",
147-
sha256 = "6e234cd5ec49ff151c9a16631fb65c145f5c615aac3dabdb6edb099d1565c85a",
146+
url = "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_137.0.3296.52-1_amd64.deb",
147+
sha256 = "b2041c75e61d0c6530ec7565a63c2458e5e53aa5bb759b354e27c9dfe0d83d37",
148148
build_file_content = """
149149
load("@aspect_rules_js//js:defs.bzl", "js_library")
150150
package(default_visibility = ["//visibility:public"])
@@ -165,8 +165,8 @@ js_library(
165165

166166
http_archive(
167167
name = "linux_edgedriver",
168-
url = "https://msedgedriver.azureedge.net/136.0.3240.76/edgedriver_linux64.zip",
169-
sha256 = "dbab1e25a3dc1013a929be5626324ee3ac0575b747793da51d6b8de93f0f2ff2",
168+
url = "https://msedgedriver.azureedge.net/136.0.3240.92/edgedriver_linux64.zip",
169+
sha256 = "8abb53e9a60e5587300835f9e039f12c81ae10b1b34231982b35b99637252109",
170170
build_file_content = """
171171
load("@aspect_rules_js//js:defs.bzl", "js_library")
172172
package(default_visibility = ["//visibility:public"])
@@ -182,8 +182,8 @@ js_library(
182182

183183
http_archive(
184184
name = "mac_edgedriver",
185-
url = "https://msedgedriver.azureedge.net/136.0.3240.76/edgedriver_mac64.zip",
186-
sha256 = "d1cc5424b522227f0c0950ac501e52a55e0fb44ee2ebc8af3a83fc9222363e8f",
185+
url = "https://msedgedriver.azureedge.net/136.0.3240.92/edgedriver_mac64.zip",
186+
sha256 = "6d24b3fa48acfb71963605ea93778c4486442fdedde5e57aecdfac36e9dbf552",
187187
build_file_content = """
188188
load("@aspect_rules_js//js:defs.bzl", "js_library")
189189
package(default_visibility = ["//visibility:public"])
@@ -199,8 +199,8 @@ js_library(
199199

200200
http_archive(
201201
name = "linux_chrome",
202-
url = "https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.40/linux64/chrome-linux64.zip",
203-
sha256 = "1a17f1d70a085188eb78365b90b435d83350fcec1040a9383eea80ed97963204",
202+
url = "https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.55/linux64/chrome-linux64.zip",
203+
sha256 = "ffedd41a261f26e2e60e5d1692e0955c292caffafd15865344d21b845554a3d4",
204204
build_file_content = """
205205
load("@aspect_rules_js//js:defs.bzl", "js_library")
206206
package(default_visibility = ["//visibility:public"])
@@ -220,8 +220,8 @@ js_library(
220220
)
221221
http_archive(
222222
name = "mac_chrome",
223-
url = "https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.40/mac-x64/chrome-mac-x64.zip",
224-
sha256 = "65fb0ae59177d2196eb62fdeb88c455f8965af2e0e9ee6640d66765c7df75450",
223+
url = "https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.55/mac-x64/chrome-mac-x64.zip",
224+
sha256 = "1342558af92f8d8f9cb26c4504f9d49b63c0b1d6fe06485c2e01c763a67deb44",
225225
strip_prefix = "chrome-mac-x64",
226226
patch_cmds = [
227227
"mv 'Google Chrome for Testing.app' Chrome.app",
@@ -241,8 +241,8 @@ js_library(
241241
)
242242
http_archive(
243243
name = "linux_chromedriver",
244-
url = "https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.40/linux64/chromedriver-linux64.zip",
245-
sha256 = "09246c6eaa804a39b8c54467bf4d62233577f67a9df11a33d8b27dd1b30a168c",
244+
url = "https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.55/linux64/chromedriver-linux64.zip",
245+
sha256 = "57b44a6b5193511898eb1c26b3eae8378a763a6d09e7687b801a799d58e7e90d",
246246
strip_prefix = "chromedriver-linux64",
247247
build_file_content = """
248248
load("@aspect_rules_js//js:defs.bzl", "js_library")
@@ -259,8 +259,8 @@ js_library(
259259

260260
http_archive(
261261
name = "mac_chromedriver",
262-
url = "https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.40/mac-x64/chromedriver-mac-x64.zip",
263-
sha256 = "c3c7cd781b217694ce35b9b7e2f3c3d214982a023a0c1a21dae4af320e409928",
262+
url = "https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.55/mac-x64/chromedriver-mac-x64.zip",
263+
sha256 = "8a6c76cde41275f539dae1c9287c50def6481f17737b6d871237e81c26eda635",
264264
strip_prefix = "chromedriver-mac-x64",
265265
build_file_content = """
266266
load("@aspect_rules_js//js:defs.bzl", "js_library")
@@ -277,8 +277,8 @@ js_library(
277277

278278
http_archive(
279279
name = "linux_beta_chrome",
280-
url = "https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.6/linux64/chrome-linux64.zip",
281-
sha256 = "1c304daed9edf8d4b5b57645e6cccf227bcc7664595b369879f89ca34d2509ac",
280+
url = "https://storage.googleapis.com/chrome-for-testing-public/138.0.7204.4/linux64/chrome-linux64.zip",
281+
sha256 = "d6ead5a796a19ccdebd603fb626eb66ebaafa82a051f03d3898cffed16d1d513",
282282
build_file_content = """
283283
load("@aspect_rules_js//js:defs.bzl", "js_library")
284284
package(default_visibility = ["//visibility:public"])
@@ -298,8 +298,8 @@ js_library(
298298
)
299299
http_archive(
300300
name = "mac_beta_chrome",
301-
url = "https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.6/mac-x64/chrome-mac-x64.zip",
302-
sha256 = "c6f3a04ea911682abcce470310433efb75ef4063ba9f02df0a22df89344947cb",
301+
url = "https://storage.googleapis.com/chrome-for-testing-public/138.0.7204.4/mac-x64/chrome-mac-x64.zip",
302+
sha256 = "07c32ddffb7ad10038cde6187891a0ba7eaf65869af38d1709b0384697ccdbfa",
303303
strip_prefix = "chrome-mac-x64",
304304
patch_cmds = [
305305
"mv 'Google Chrome for Testing.app' Chrome.app",
@@ -319,8 +319,8 @@ js_library(
319319
)
320320
http_archive(
321321
name = "linux_beta_chromedriver",
322-
url = "https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.6/linux64/chromedriver-linux64.zip",
323-
sha256 = "0d5ba6533e60b44b39f41b4313696b41bb7b466f29aa00cb82df030392559854",
322+
url = "https://storage.googleapis.com/chrome-for-testing-public/138.0.7204.4/linux64/chromedriver-linux64.zip",
323+
sha256 = "187813f44358a8bfa42bd043eced9481687998ff0f691a46108555574836ad38",
324324
strip_prefix = "chromedriver-linux64",
325325
build_file_content = """
326326
load("@aspect_rules_js//js:defs.bzl", "js_library")
@@ -337,8 +337,8 @@ js_library(
337337

338338
http_archive(
339339
name = "mac_beta_chromedriver",
340-
url = "https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.6/mac-x64/chromedriver-mac-x64.zip",
341-
sha256 = "d01e48e534b48ab1f6401642720eec95773b069ad8a3042969d1fd708a4fb6c2",
340+
url = "https://storage.googleapis.com/chrome-for-testing-public/138.0.7204.4/mac-x64/chromedriver-mac-x64.zip",
341+
sha256 = "9823d0e33d930761a9967dce0403a53dc5b2d3376af46cd3e7f10bc28bfe401d",
342342
strip_prefix = "chromedriver-mac-x64",
343343
build_file_content = """
344344
load("@aspect_rules_js//js:defs.bzl", "js_library")

scripts/pinned_browsers.py

Lines changed: 42 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env python
22

3-
import argparse
43
import hashlib
54
import json
65
import os
@@ -26,14 +25,7 @@ def calculate_hash(url):
2625
return h.hexdigest()
2726

2827

29-
def get_chrome_milestone():
30-
parser = argparse.ArgumentParser()
31-
parser.add_argument(
32-
"--chrome_channel", default="Stable", help="Set the Chrome channel"
33-
)
34-
args = parser.parse_args()
35-
channel = args.chrome_channel
36-
28+
def get_chrome_info_for_channel(channel):
3729
r = http.request(
3830
"GET",
3931
f"https://chromiumdash.appspot.com/fetch_releases?channel={channel}&num=1&platform=Mac,Linux",
@@ -55,20 +47,18 @@ def get_chrome_milestone():
5547
)[-1]
5648

5749

58-
def chromedriver(selected_version):
50+
def chromedriver(selected_version, workspace_prefix=""):
5951
content = ""
6052

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

63-
linux = [d["url"] for d in drivers if d["platform"] == "linux64"][0]
64-
sha = calculate_hash(linux)
55+
url = [d["url"] for d in drivers if d["platform"] == "linux64"][0]
56+
sha = calculate_hash(url)
6557

66-
content = (
67-
content
68-
+ """ http_archive(
69-
name = "linux_chromedriver",
70-
url = "%s",
71-
sha256 = "%s",
58+
content += f""" http_archive(
59+
name = "linux_{workspace_prefix}chromedriver",
60+
url = "{url}",
61+
sha256 = "{sha}",
7262
strip_prefix = "chromedriver-linux64",
7363
build_file_content = \"\"\"
7464
load("@aspect_rules_js//js:defs.bzl", "js_library")
@@ -83,18 +73,15 @@ def chromedriver(selected_version):
8373
\"\"\",
8474
)
8575
"""
86-
% (linux, sha)
87-
)
8876

89-
mac = [d["url"] for d in drivers if d["platform"] == "mac-x64"][0]
90-
sha = calculate_hash(mac)
91-
content = (
92-
content
93-
+ """
77+
url = [d["url"] for d in drivers if d["platform"] == "mac-x64"][0]
78+
sha = calculate_hash(url)
79+
80+
content += f"""
9481
http_archive(
95-
name = "mac_chromedriver",
96-
url = "%s",
97-
sha256 = "%s",
82+
name = "mac_{workspace_prefix}chromedriver",
83+
url = "{url}",
84+
sha256 = "{sha}",
9885
strip_prefix = "chromedriver-mac-x64",
9986
build_file_content = \"\"\"
10087
load("@aspect_rules_js//js:defs.bzl", "js_library")
@@ -109,23 +96,22 @@ def chromedriver(selected_version):
10996
\"\"\",
11097
)
11198
"""
112-
% (mac, sha)
113-
)
11499

115100
return content
116101

117102

118-
def chrome(selected_version):
103+
def chrome(selected_version, workspace_prefix=""):
104+
content = ""
119105
chrome_downloads = selected_version["downloads"]["chrome"]
120106

121-
linux = [d["url"] for d in chrome_downloads if d["platform"] == "linux64"][0]
122-
sha = calculate_hash(linux)
107+
url = [d["url"] for d in chrome_downloads if d["platform"] == "linux64"][0]
108+
sha = calculate_hash(url)
123109

124-
content = """
110+
content += f"""
125111
http_archive(
126-
name = "linux_chrome",
127-
url = "%s",
128-
sha256 = "%s",
112+
name = "linux_{workspace_prefix}chrome",
113+
url = "{url}",
114+
sha256 = "{sha}",
129115
build_file_content = \"\"\"
130116
load("@aspect_rules_js//js:defs.bzl", "js_library")
131117
package(default_visibility = ["//visibility:public"])
@@ -143,19 +129,15 @@ def chrome(selected_version):
143129
)
144130
\"\"\",
145131
)
132+
"""
146133

147-
""" % (
148-
linux,
149-
sha,
150-
)
151-
152-
mac = [d["url"] for d in chrome_downloads if d["platform"] == "mac-x64"][0]
153-
sha = calculate_hash(mac)
134+
url = [d["url"] for d in chrome_downloads if d["platform"] == "mac-x64"][0]
135+
sha = calculate_hash(url) # Calculate SHA for Mac chrome
154136

155-
content += """ http_archive(
156-
name = "mac_chrome",
157-
url = "%s",
158-
sha256 = "%s",
137+
content += f""" http_archive(
138+
name = "mac_{workspace_prefix}chrome",
139+
url = "{url}",
140+
sha256 = "{sha}",
159141
strip_prefix = "chrome-mac-x64",
160142
patch_cmds = [
161143
"mv 'Google Chrome for Testing.app' Chrome.app",
@@ -173,15 +155,10 @@ def chrome(selected_version):
173155
)
174156
\"\"\",
175157
)
176-
177-
""" % (
178-
mac,
179-
sha,
180-
)
158+
"""
181159

182160
return content
183161

184-
185162
def convert_keys_to_lowercase(obj):
186163
if isinstance(obj, dict):
187164
return {k.lower(): convert_keys_to_lowercase(v) for k, v in obj.items()}
@@ -523,9 +500,17 @@ def pin_browsers():
523500
content = content + geckodriver()
524501
content = content + edge()
525502
content = content + edgedriver()
526-
chrome_milestone = get_chrome_milestone()
527-
content = content + chrome(chrome_milestone)
528-
content = content + chromedriver(chrome_milestone)
503+
504+
# Stable Chrome
505+
stable_chrome_info = get_chrome_info_for_channel(channel="Stable")
506+
content = content + chrome(stable_chrome_info, workspace_prefix="")
507+
content = content + chromedriver(stable_chrome_info, workspace_prefix="")
508+
509+
# Beta Chrome
510+
beta_chrome_info = get_chrome_info_for_channel(channel="Beta")
511+
content = content + chrome(beta_chrome_info, workspace_prefix="beta_")
512+
content = content + chromedriver(beta_chrome_info, workspace_prefix="beta_")
513+
529514
content += """
530515
def _pin_browsers_extension_impl(_ctx):
531516
pin_browsers()

0 commit comments

Comments
 (0)