[Reporting] bump puppeteer and chromium (#153033)

## Summary

Part of https://github.com/elastic/kibana/issues/151211

Update puppeteer to 19.7.2 and update to corresponding chromium
(r1095492, v 111.0.5555.0)

We hit an issue that webgl stopped working in headless mode on arm mac
https://github.com/elastic/kibana/pull/153033#issuecomment-1464118444,
turns out this is a known issue - headless uses swiftshader by default
and swiftshader's support for WebGL is currently disabled on Arm pending
the resolution of https://issuetracker.google.com/issues/165000222.
As a workaround, we force hardware GL drivers on arm mac:
 - for the current version we pass `--use-angle` (v111)
 - for the next version we should update it with `--enable-gpu` (v112)




### Testing 

- Tested locally on a Mac 
- Linux with CI deploy tag
- Windows locally


### Release Notes

Reporting: Update Chromium to 111.0.5555.0 (r1095492) and Puppeteer to
19.7.2
This commit is contained in:
Anton Dosov 2023-03-30 12:16:21 +02:00 committed by GitHub
parent c816004392
commit d208e0091a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 133 additions and 40 deletions

View file

@ -849,7 +849,7 @@
"prop-types": "^15.8.1",
"proxy-from-env": "1.0.0",
"puid": "1.0.7",
"puppeteer": "18.2.1",
"puppeteer": "19.7.2",
"query-string": "^6.13.2",
"rbush": "^3.0.1",
"re-resizable": "^6.1.1",

View file

@ -12,7 +12,7 @@ import {
} from '@kbn/screenshot-mode-plugin/server';
import { truncate } from 'lodash';
import open from 'opn';
import puppeteer, { ElementHandle, Page, EvaluateFunc } from 'puppeteer';
import { ElementHandle, Page, EvaluateFunc, HTTPResponse } from 'puppeteer';
import { Subject } from 'rxjs';
import { parse as parseUrl } from 'url';
import { getDisallowedOutgoingUrlError } from '.';
@ -426,7 +426,7 @@ export class HeadlessChromiumDriver {
this.interceptedCount = this.interceptedCount + (isData ? 0 : 1);
});
this.page.on('response', (interceptedResponse: puppeteer.HTTPResponse) => {
this.page.on('response', (interceptedResponse: HTTPResponse) => {
const interceptedUrl = interceptedResponse.url();
const allowed = !interceptedUrl.startsWith('file://');
const status = interceptedResponse.status();

View file

@ -0,0 +1,55 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import os from 'os';
import { args } from './args';
import { getChromiumPackage } from '../../../utils';
// Since chromium v111 headless mode in arm based macs is not working with `--disable-gpu`
// This is a known issue: headless uses swiftshader by default and swiftshader's support for WebGL is currently disabled on Arm pending the resolution of https://issuetracker.google.com/issues/165000222.
// As a workaround, we force hardware GL drivers on mac.
// The best way to do this starting with v112 is by passing --enable-gpu,
// v111 and older versions should work with --use-angle.
describe('headless webgl arm mac workaround', () => {
const originalPlatform = process.platform;
afterEach(() => {
Object.defineProperty(process, 'platform', {
value: originalPlatform,
});
});
const simulateEnv = (platform: string, arch: string) => {
Object.defineProperty(process, 'platform', { value: platform });
jest.spyOn(os, 'arch').mockReturnValue(arch);
};
test('disables gpu for non arm mac', () => {
simulateEnv('darwin', 'x64');
const flags = args({
userDataDir: '/',
proxy: { enabled: false },
});
expect(flags.includes(`--disable-gpu`)).toBe(true);
});
test("doesn't disable gpu when on an arm mac, adds --use-angle", () => {
simulateEnv('darwin', 'arm64');
const flags = args({
userDataDir: '/',
proxy: { enabled: false },
});
expect(flags.includes(`--disable-gpu`)).toBe(false);
expect(flags.includes(`--use-angle`)).toBe(true);
// if you're updating this, then you're likely updating chromium
// please double-check that the --use-angle flag is still needed for arm macs
// if you're updating to v112, then likely instead of --use-angle you should use --enable-gpu
expect(getChromiumPackage().binaryChecksum).toBe('0a12a34a0d8bc9c616d3cc339abb167e'); // just putting this here so that someone updating the chromium version will see this comment
});
});

View file

@ -5,6 +5,7 @@
* 2.0.
*/
import os from 'os';
import type { ConfigType } from '../../../config';
interface WindowSize {
@ -48,7 +49,6 @@ export const args = ({
// Skip first run wizards
'--no-first-run',
`--user-data-dir=${userDataDir}`,
'--disable-gpu',
'--headless',
'--hide-scrollbars',
// allow screenshot clip region to go outside of the viewport
@ -73,7 +73,18 @@ export const args = ({
flags.push('--no-sandbox');
}
if (process.platform === 'linux') {
// Since chromium v111 headless mode in arm based macs is not working with `--disable-gpu`
// This is a known issue: headless uses swiftshader by default and swiftshader's support for WebGL is currently disabled on Arm pending the resolution of https://issuetracker.google.com/issues/165000222.
// As a workaround, we force hardware GL drivers on mac.
// The best way to do this starting with v112 is by passing --enable-gpu,
// v111 and older versions should work with --use-angle.
if (os.arch() === 'arm64' && process.platform === 'darwin') {
flags.push('--use-angle');
} else {
flags.push('--disable-gpu');
}
if (os.arch() === 'linux') {
flags.push('--disable-setuid-sandbox');
}

View file

@ -7,7 +7,7 @@
import type { Logger } from '@kbn/core/server';
import type { ScreenshotModePluginSetup } from '@kbn/screenshot-mode-plugin/server';
import puppeteer from 'puppeteer';
import * as puppeteer from 'puppeteer';
import * as Rx from 'rxjs';
import { mergeMap, take } from 'rxjs/operators';
import { DEFAULT_VIEWPORT, HeadlessChromiumDriverFactory } from '.';

View file

@ -18,7 +18,7 @@ export interface PackageInfo {
location: 'custom' | 'common';
}
const REVISION = 1036745;
const REVISION = 1095492;
enum BaseUrl {
// see https://www.chromium.org/getting-involved/download-chromium
@ -45,8 +45,8 @@ export class ChromiumArchivePaths {
platform: 'darwin',
architecture: 'x64',
archiveFilename: 'chrome-mac.zip',
archiveChecksum: 'dd4d44ad97ba2fef5dc47d7f2a39ccaa',
binaryChecksum: '4a7a663b2656d66ce975b00a30df3ab4',
archiveChecksum: '318ac652b5ba64fb3b37a25e312ffd6e',
binaryChecksum: '107a554a0f7828a1844173cb3830716c',
binaryRelativePath: 'chrome-mac/Chromium.app/Contents/MacOS/Chromium',
location: 'common',
archivePath: 'Mac',
@ -56,8 +56,8 @@ export class ChromiumArchivePaths {
platform: 'darwin',
architecture: 'arm64',
archiveFilename: 'chrome-mac.zip',
archiveChecksum: '5afc0d49865d55b69ea1ff65b9cc5794',
binaryChecksum: '4a7a663b2656d66ce975b00a30df3ab4',
archiveChecksum: 'e8f09d0c992d181b986d38a13dfb88c3',
binaryChecksum: '0a12a34a0d8bc9c616d3cc339abb167e',
binaryRelativePath: 'chrome-mac/Chromium.app/Contents/MacOS/Chromium',
location: 'common',
archivePath: 'Mac_Arm',
@ -66,9 +66,9 @@ export class ChromiumArchivePaths {
{
platform: 'linux',
architecture: 'x64',
archiveFilename: 'chromium-749e738-locales-linux_x64.zip',
archiveChecksum: '09ba194e6c720397728fbec3d3895b0b',
binaryChecksum: 'df1c957f41dcca8e33369b1d255406c2',
archiveFilename: 'chromium-7abd50c-locales-linux_x64.zip',
archiveChecksum: 'dc141a6cae734c29a1144d3d9f8ca7ee',
binaryChecksum: '9b9611ba0c65fc34d1be1e40ae80c036',
binaryRelativePath: 'headless_shell-linux_x64/headless_shell',
location: 'custom',
isPreInstalled: true,
@ -76,9 +76,9 @@ export class ChromiumArchivePaths {
{
platform: 'linux',
architecture: 'arm64',
archiveFilename: 'chromium-749e738-locales-linux_arm64.zip',
archiveChecksum: '1f535b1c2875d471829c6ff128a13262',
binaryChecksum: 'ca6b91d0ba8a65712554572dabc66968',
archiveFilename: 'chromium-7abd50c-locales-linux_arm64.zip',
archiveChecksum: '1ce431a6cd7b3d7e5aa63fc8f7327b0f',
binaryChecksum: 'ef21a88efa18f000e6da6d9c51ee2fd7',
binaryRelativePath: 'headless_shell-linux_arm64/headless_shell',
location: 'custom',
isPreInstalled: true,
@ -87,8 +87,8 @@ export class ChromiumArchivePaths {
platform: 'win32',
architecture: 'x64',
archiveFilename: 'chrome-win.zip',
archiveChecksum: '42db052673414b89d8cb45657c1a6aeb',
binaryChecksum: '1b6eef775198ffd48fb9669ac0c818f7',
archiveChecksum: '83e7e89ae749668d3eaa8b3bd6120e8a',
binaryChecksum: 'cbfe0d2db3117f13554999bdc7aab68d',
binaryRelativePath: path.join('chrome-win', 'chrome.exe'),
location: 'common',
archivePath: 'Win',

View file

@ -88,11 +88,14 @@ describe('ensureDownloaded', () => {
expect.arrayContaining([
'chrome-mac.zip',
'chrome-win.zip',
'chromium-749e738-locales-linux_x64.zip',
expect.stringMatching(/^chromium-[0-9a-f]{7}-locales-linux_x64\.zip$/),
])
);
expect(readdirSync(path.resolve(`${paths.archivesPath}/arm64`))).toEqual(
expect.arrayContaining(['chrome-mac.zip', 'chromium-749e738-locales-linux_arm64.zip'])
expect.arrayContaining([
'chrome-mac.zip',
expect.stringMatching(/^chromium-[0-9a-f]{7}-locales-linux_arm64\.zip$/),
])
);
});

View file

@ -11873,6 +11873,13 @@ chromedriver@^110.0.0:
proxy-from-env "^1.1.0"
tcp-port-used "^1.0.1"
chromium-bidi@0.4.4:
version "0.4.4"
resolved "https://registry.yarnpkg.com/chromium-bidi/-/chromium-bidi-0.4.4.tgz#44f25d4fa5d2f3debc3fc3948d0657194cac4407"
integrity sha512-4BX5cSaponuvVT1+SbLYTOAgDoVtX/Khoc9UsbFJ/AsPVUeFAM3RiIDFI6XFhLYMi9WmVJqh1ZH+dRpNKkKwiQ==
dependencies:
mitt "3.0.0"
ci-info@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46"
@ -12533,6 +12540,16 @@ core-util-is@1.0.2, core-util-is@^1.0.2, core-util-is@~1.0.0:
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=
cosmiconfig@8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-8.0.0.tgz#e9feae014eab580f858f8a0288f38997a7bebe97"
integrity sha512-da1EafcpH6b/TD8vDRaWV7xFINlHlF6zKsGwS1TsuVJTZRkquaS5HTMq7uq6h31619QjbsYl21gVDOm32KM1vQ==
dependencies:
import-fresh "^3.2.1"
js-yaml "^4.1.0"
parse-json "^5.0.0"
path-type "^4.0.0"
cosmiconfig@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-6.0.0.tgz#da4fee853c52f6b1e6935f41c1a2fc50bd4a9982"
@ -13865,10 +13882,10 @@ detective@^5.0.2:
defined "^1.0.0"
minimist "^1.1.1"
devtools-protocol@0.0.1045489:
version "0.0.1045489"
resolved "https://registry.yarnpkg.com/devtools-protocol/-/devtools-protocol-0.0.1045489.tgz#f959ad560b05acd72d55644bc3fb8168a83abf28"
integrity sha512-D+PTmWulkuQW4D1NTiCRCFxF7pQPn0hgp4YyX4wAQ6xYXKOadSWPR3ENGDQ47MW/Ewc9v2rpC/UEEGahgBYpSQ==
devtools-protocol@0.0.1094867:
version "0.0.1094867"
resolved "https://registry.yarnpkg.com/devtools-protocol/-/devtools-protocol-0.0.1094867.tgz#2ab93908e9376bd85d4e0604aa2651258f13e374"
integrity sha512-pmMDBKiRVjh0uKK6CT1WqZmM3hBVSgD+N2MrgyV1uNizAZMw4tx6i/RTc+/uCsKSCmg0xXx7arCP/OFcIwTsiQ==
dezalgo@^1.0.0:
version "1.0.3"
@ -21147,6 +21164,11 @@ mississippi@^3.0.0:
stream-each "^1.1.0"
through2 "^2.0.0"
mitt@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/mitt/-/mitt-3.0.0.tgz#69ef9bd5c80ff6f57473e8d89326d01c414be0bd"
integrity sha512-7dX2/10ITVyqh4aOSVI9gdape+t9l2/8QxHrFmUXu4EEUpdlxl6RudZUPZoc+zuY2hk1j7XxVroIVIan/pD/SQ==
mixin-deep@^1.2.0:
version "1.3.2"
resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566"
@ -23674,31 +23696,33 @@ pupa@^2.1.1:
dependencies:
escape-goat "^2.0.0"
puppeteer-core@18.2.1:
version "18.2.1"
resolved "https://registry.yarnpkg.com/puppeteer-core/-/puppeteer-core-18.2.1.tgz#9b7827bb2bf478bb615e2c21425e4659555dc1fe"
integrity sha512-MRtTAZfQTluz3U2oU/X2VqVWPcR1+94nbA2V6ZrSZRVEwLqZ8eclZ551qGFQD/vD2PYqHJwWOW/fpC721uznVw==
puppeteer-core@19.7.2:
version "19.7.2"
resolved "https://registry.yarnpkg.com/puppeteer-core/-/puppeteer-core-19.7.2.tgz#deee9ef915829b6a1d1a3a008625c29eeb251161"
integrity sha512-PvI+fXqgP0uGJxkyZcX51bnzjFA73MODZOAv0fSD35yR7tvbqwtMV3/Y+hxQ0AMMwzxkEebP6c7po/muqxJvmQ==
dependencies:
chromium-bidi "0.4.4"
cross-fetch "3.1.5"
debug "4.3.4"
devtools-protocol "0.0.1045489"
devtools-protocol "0.0.1094867"
extract-zip "2.0.1"
https-proxy-agent "5.0.1"
proxy-from-env "1.1.0"
rimraf "3.0.2"
tar-fs "2.1.1"
unbzip2-stream "1.4.3"
ws "8.9.0"
ws "8.11.0"
puppeteer@18.2.1:
version "18.2.1"
resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-18.2.1.tgz#08967cd423efe511ee4c6e3a5c882ffaf2e6bbf3"
integrity sha512-7+UhmYa7wxPh2oMRwA++k8UGVDxh3YdWFB52r9C3tM81T6BU7cuusUSxImz0GEYSOYUKk/YzIhkQ6+vc0gHbxQ==
puppeteer@19.7.2:
version "19.7.2"
resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-19.7.2.tgz#1b3ce99a093cc2f8f84dfb06f066d0757ea79d4b"
integrity sha512-4Lm7Qpe/LU95Svirei/jDLDvR5oMrl9BPGd7HMY5+Q28n+BhvKuW97gKkR+1LlI86bO8J3g8rG/Ll5kv9J1nlQ==
dependencies:
cosmiconfig "8.0.0"
https-proxy-agent "5.0.1"
progress "2.0.3"
proxy-from-env "1.1.0"
puppeteer-core "18.2.1"
puppeteer-core "19.7.2"
q@^1.5.1:
version "1.5.1"
@ -29512,10 +29536,10 @@ write-file-atomic@^4.0.1:
imurmurhash "^0.1.4"
signal-exit "^3.0.7"
ws@8.9.0:
version "8.9.0"
resolved "https://registry.yarnpkg.com/ws/-/ws-8.9.0.tgz#2a994bb67144be1b53fe2d23c53c028adeb7f45e"
integrity sha512-Ja7nszREasGaYUYCI2k4lCKIRTt+y7XuqVoHR44YpI49TtryyqbqvDMn5eqfW7e6HzTukDRIsXqzVHScqRcafg==
ws@8.11.0:
version "8.11.0"
resolved "https://registry.yarnpkg.com/ws/-/ws-8.11.0.tgz#6a0d36b8edfd9f96d8b25683db2f8d7de6e8e143"
integrity sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==
ws@>=8.11.0, ws@^8.2.3, ws@^8.4.2, ws@^8.9.0:
version "8.12.0"