Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add channel parameter in check_availability roll mode #6400

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 21 additions & 14 deletions utils/check_availability.js
Expand Up @@ -56,23 +56,30 @@ class Table {
const helpMessage = `
This script checks availability of prebuilt Chromium snapshots.

Usage: node check_availability.js [<options>] [<browser version(s)>]
Usage

options
-f full mode checks availability of all the platforms, default mode
-r roll mode checks for the most recent Chromium roll candidate
-h show this help
Full Mode: checks availability of all the platforms, default mode
$ node check_availability.js [-f] [<browser version(s)>]

browser version(s)
<revision> single revision number means checking for this specific revision
<from> <to> checks all the revisions within a given range, inclusively


Roll Mode: checks for the most recent Chromium roll candidate in the given channel
$ node check_availability.js -r [stable | beta | dev]

The default channel is stable.

Examples
To check Chromium availability of a certain revision
node check_availability.js [revision]

To find a Chromium roll candidate for current Stable Linux version
node check_availability.js -r

To find a Chromium roll candidate for current Beta Linux version
node check_availability.js -r beta

To check Chromium availability from the latest revision in a descending order
node check_availability.js
Expand All @@ -97,7 +104,7 @@ function main() {
case 'f':
break;
case 'r':
checkRollCandidate();
checkRollCandidate(args[1]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's assert that args[1] is one of the supported values here, and error out otherwise

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const supportedChannels = new Map(['stable', 'beta', 'dev']);

return;
default:
console.log(helpMessage);
Expand Down Expand Up @@ -149,18 +156,18 @@ async function checkOmahaProxyAvailability() {
});
}

async function checkRollCandidate() {
async function checkRollCandidate(channel = 'stable') {
const omahaResponse = await fetch(
'https://omahaproxy.appspot.com/all.json?channel=stable&os=linux'
`https://omahaproxy.appspot.com/all.json?channel=${channel}&os=linux`
);
const stableLinuxInfo = JSON.parse(omahaResponse)[0];
if (!stableLinuxInfo) {
console.error('no stable linux information available from omahaproxy');
const linuxRevisionInfo = JSON.parse(omahaResponse)[0];
if (!linuxRevisionInfo) {
console.error(`no ${channel} linux information available from omahaproxy`);
return;
}

const stableLinuxRevision = parseInt(
stableLinuxInfo.versions[0].branch_base_position,
const linuxRevision = parseInt(
linuxRevisionInfo.versions[0].branch_base_position,
10
);
const currentRevision = parseInt(
Expand All @@ -169,7 +176,7 @@ async function checkRollCandidate() {
);

checkRangeAvailability({
fromRevision: stableLinuxRevision,
fromRevision: linuxRevision,
toRevision: currentRevision,
stopWhenAllAvailable: true,
});
Expand Down