|
9 | 9 |
|
10 | 10 | LAST_KNOWN_GOOD = "https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json" |
11 | 11 | KNOWN_GOOD_WITH_DOWNLOADS = "https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json" |
12 | | -RELEASES = "https://chromiumdash.appspot.com/fetch_releases" |
13 | 12 |
|
14 | | -# Consumer channel rolls out per-platform; these are the platforms we pin binaries for. |
15 | | -PINNED_PLATFORMS = ("Mac", "Linux") |
16 | 13 |
|
| 14 | +def latest_for_channel(channel): |
| 15 | + """Return the newest Chrome-for-Testing version entry (version + downloads) for a channel. |
17 | 16 |
|
18 | | -def chrome_for_milestone(milestone): |
19 | | - """Return the newest Chrome-for-Testing version entry (version + downloads) for a milestone.""" |
| 17 | + Uses Chrome-for-Testing's channel designation (e.g. "Stable", "Beta"), which tracks the |
| 18 | + latest milestone and is unaffected by N-1 security respins. |
| 19 | + """ |
| 20 | + r = http.request("GET", LAST_KNOWN_GOOD) |
| 21 | + milestone = json.loads(r.data)["channels"][channel]["version"].split(".")[0] |
20 | 22 | r = http.request("GET", KNOWN_GOOD_WITH_DOWNLOADS) |
21 | 23 | versions = json.loads(r.data)["versions"] |
22 | 24 | return sorted( |
23 | 25 | filter(lambda v: v["version"].split(".")[0] == str(milestone), versions), |
24 | 26 | key=lambda v: parse(v["version"]), |
25 | 27 | )[-1] |
26 | | - |
27 | | - |
28 | | -def latest_for_channel(channel): |
29 | | - """Newest version Chrome-for-Testing designates for a channel (e.g. "Stable", "Beta"). |
30 | | -
|
31 | | - Adopts a new milestone as soon as its binaries ship, without waiting for consumer rollout. |
32 | | - """ |
33 | | - r = http.request("GET", LAST_KNOWN_GOOD) |
34 | | - milestone = json.loads(r.data)["channels"][channel]["version"].split(".")[0] |
35 | | - return chrome_for_milestone(milestone) |
36 | | - |
37 | | - |
38 | | -def conservative_for_channel(channel): |
39 | | - """Newest milestone that has reached the consumer channel on every pinned platform. |
40 | | -
|
41 | | - Per-platform we take the highest milestone seen (respin-immune: an N-1 security respin |
42 | | - can't hide that the platform also has N), then the lowest across platforms so a staggered |
43 | | - rollout steps back to N-1 until every platform has N. |
44 | | - """ |
45 | | - milestones = [] |
46 | | - for platform in PINNED_PLATFORMS: |
47 | | - r = http.request("GET", f"{RELEASES}?channel={channel}&num=20&platform={platform}") |
48 | | - seen = [release["milestone"] for release in json.loads(r.data) if release["milestone"]] |
49 | | - if not seen: |
50 | | - raise ValueError(f"No {channel} milestone found for platform '{platform}'") |
51 | | - milestones.append(max(seen)) |
52 | | - return chrome_for_milestone(min(milestones)) |
0 commit comments