Skip to content

Commit 3638e7a

Browse files
Temporarily hardcode chromedriver to 112.0.0 to enable all ftr tests (#3976) (#4038)
The latest version of chromedriver is 112.0.1 which does not support node 14. This PR hardcodes chromedriver to 112.0.0 temporarily. Pls revert it once we bump to node 18. Issue Resolved #3975 Signed-off-by: ananzh <ananzh@amazon.com> (cherry picked from commit 5ea0cbe) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 7786641 commit 3638e7a

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

scripts/upgrade_chromedriver.js

+21-6
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,31 @@ const versionCheckOutputTokens = (versionCheckOutput || '').match(/(?:^|\s)(9\d|
7272
const majorVersion = Array.isArray(versionCheckOutputTokens) && versionCheckOutputTokens[1];
7373

7474
if (majorVersion) {
75+
let targetVersion = `^${majorVersion}`;
76+
77+
// TODO: Temporary fix to install chromedriver 112.0.0 if major version is 112.
78+
// Exit if major version is greater than 112.
79+
// Revert this once node is bumped to 16+.
80+
// https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3975
81+
if (parseInt(majorVersion) === 112) {
82+
targetVersion = '112.0.0';
83+
} else if (parseInt(majorVersion) > 112) {
84+
console.error(
85+
`::error::Chrome version (${majorVersion}) is not supported by this script. The largest chrome version we support is 112.`
86+
);
87+
process.exit(1);
88+
}
89+
7590
if (process.argv.includes('--install')) {
76-
console.log(`Installing chromedriver@^${majorVersion}`);
91+
console.log(`Installing chromedriver@${targetVersion}`);
7792

78-
spawnSync(`yarn add --dev chromedriver@^${majorVersion}`, {
93+
spawnSync(`yarn add --dev chromedriver@${targetVersion}`, {
7994
stdio: 'inherit',
8095
cwd: process.cwd(),
8196
shell: true,
8297
});
8398
} else {
84-
console.log(`Upgrading to chromedriver@^${majorVersion}`);
99+
console.log(`Upgrading to chromedriver@${targetVersion}`);
85100

86101
let upgraded = false;
87102
const writeStream = createWriteStream('package.json.upgrading-chromedriver', { flags: 'w' });
@@ -93,7 +108,7 @@ if (majorVersion) {
93108
if (line.includes('"chromedriver": "')) {
94109
line = line.replace(
95110
/"chromedriver":\s*"[~^]?\d[\d.]*\d"/,
96-
`"chromedriver": "^${majorVersion}"`
111+
`"chromedriver": "${targetVersion}"`
97112
);
98113
upgraded = true;
99114
}
@@ -108,11 +123,11 @@ if (majorVersion) {
108123
renameSync('package.json', 'package.json.bak');
109124
renameSync('package.json.upgrading-chromedriver', 'package.json');
110125

111-
console.log(`Backed up package.json and updated chromedriver to ${majorVersion}`);
126+
console.log(`Backed up package.json and updated chromedriver to ${targetVersion}`);
112127
} else {
113128
unlinkSync('package.json.upgrading-chromedriver');
114129
console.error(
115-
`Failed to update chromedriver to ${majorVersion}. Try adding the \`--install\` switch.`
130+
`Failed to update chromedriver to ${targetVersion}. Try adding the \`--install\` switch.`
116131
);
117132
}
118133
});

0 commit comments

Comments
 (0)