[7.x] Chore/bump chromium webgl+kerberos (#42751) (#44150)

* Chore/bump chromium webgl+kerberos (#42751)

* WIP: Adding libs for webgl

* WIP Adding swiftshader libs to chromium

* WIP: Adding missing binaries for webgl in chromium

* Use pipes for communication with chrome to avoid networking snafus

* Bumps puppeteer in prep for new chromium build + types and better @types package

* Remove ignore

* Removing of final @ts-ignore now that we have types

* README updates

* Fixing binding issues

* Fixing maps integration wrt reporting + conditional pipes for puppeteer

* Adding new deps to the windows build

* New s3 builds

* Checksums for updated linux build

* Moving types out of puppeteer file and into core puppeteer module

* launch => puppeteerLaunch

* Maps comment about render loading in reporting

* Clarify how reporting uses hooks and events for viz

* Type fix from merge conflict
This commit is contained in:
Joel Griffith 2019-08-27 18:23:43 -07:00 committed by GitHub
parent 13050c6eed
commit 7e1c2249f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 102 additions and 53 deletions

View file

@ -86,13 +86,13 @@ In windows, at least, you will need to do a number of extra steps:
Find the sha of the Chromium commit you wish to build. Most likely, you want to build the Chromium revision that is tied to the version of puppeteer that we're using.
Find the Chromium revision (modify the following command to be wherever you have the kibana source installed):
Find the Chromium revision (run in kibana's working directory):
- `cat ~/dev/elastic/kibana/x-pack/node_modules/puppeteer-core/package.json | grep chromium_revision`
- `cat node_modules/puppeteer-core/package.json | grep chromium_revision`
- Take the revision number from that, and tack it to the end of this URL: https://crrev.com
- (For example: https://crrev.com/637110)
- (For example, puppeteer@1.19.0 has rev (674921): https://crrev.com/674921)
- Grab the SHA from there
- (For example, rev 637110 has sha 2fac04abf6133ab2da2846a8fbd0e97690722699)
- (For example, rev 674921 has sha 312d84c8ce62810976feda0d3457108a6dfff9e6)
Note: In Linux, you should run the build command in tmux so that if your ssh session disconnects, the build can keep going. To do this, just type `tmux` into your terminal to hop into a tmux session. If you get disconnected, you can hop back in like so:
@ -102,9 +102,9 @@ Note: In Linux, you should run the build command in tmux so that if your ssh ses
To run the build, replace the sha in the following commands with the sha that you wish to build:
- Mac: `python ~/chromium/build_chromium/build.py 2fac04abf6133ab2da2846a8fbd0e97690722699`
- Linux: `python ~/chromium/build_chromium/build.py 2fac04abf6133ab2da2846a8fbd0e97690722699`
- Windows: `python c:\chromium\build_chromium\build.py 2fac04abf6133ab2da2846a8fbd0e97690722699`
- Mac: `python ~/chromium/build_chromium/build.py 312d84c8ce62810976feda0d3457108a6dfff9e6`
- Linux: `python ~/chromium/build_chromium/build.py 312d84c8ce62810976feda0d3457108a6dfff9e6`
- Windows: `python c:\chromium\build_chromium\build.py 312d84c8ce62810976feda0d3457108a6dfff9e6`
## Artifacts

View file

@ -73,13 +73,23 @@ def archive_file(name):
# must be bundled with the Chromium executable.
if platform.system() == 'Linux':
archive_file('headless_shell')
archive_file(os.path.join('swiftshader', 'libEGL.so'))
archive_file(os.path.join('swiftshader', 'libGLESv2.so'))
elif platform.system() == 'Windows':
archive_file('headless_shell.exe')
archive_file('dbghelp.dll')
archive_file('icudtl.dat')
archive_file(os.path.join('swiftshader', 'libEGL.dll'))
archive_file(os.path.join('swiftshader', 'libEGL.dll.lib'))
archive_file(os.path.join('swiftshader', 'libGLESv2.dll'))
archive_file(os.path.join('swiftshader', 'libGLESv2.dll.lib'))
elif platform.system() == 'Darwin':
archive_file('headless_shell')
archive_file('Helpers/chrome_crashpad_handler')
archive_file('libswiftshader_libEGL.dylib')
archive_file('libswiftshader_libGLESv2.dylib')
archive_file(path.join('Helpers', 'chrome_crashpad_handler'))
archive.close()

View file

@ -16,11 +16,15 @@ import { ExitFullScreenButton } from 'ui/exit_full_screen';
import { getIndexPatternsFromIds } from '../../index_pattern_util';
import { ES_GEO_FIELD_TYPE } from '../../../common/constants';
import { i18n } from '@kbn/i18n';
import uuid from 'uuid/v4';
const RENDER_COMPLETE_EVENT = 'renderComplete';
export class GisMap extends Component {
state = {
isInitialLoadRenderTimeoutComplete: false,
domId: uuid(),
geoFields: [],
}
@ -47,6 +51,21 @@ export class GisMap extends Component {
this._clearRefreshTimer();
}
// Reporting uses both a `data-render-complete` attribute and a DOM event listener to determine
// if a visualization is done loading. The process roughly is:
// - See if the `data-render-complete` attribute is "true". If so we're done!
// - If it's not, then reporting injects a listener into the browser for a custom "renderComplete" event.
// - When that event is fired, we snapshot the viz and move on.
// Failure to not have the dom attribute, or custom event, will timeout the job.
// See x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/wait_for_render.ts for more.
_onInitialLoadRenderComplete = () => {
const el = document.querySelector(`[data-dom-id="${this.state.domId}"]`);
if (el) {
el.dispatchEvent(new CustomEvent(RENDER_COMPLETE_EVENT, { bubbles: true }));
}
}
_loadGeoFields = async (nextIndexPatternIds) => {
if (_.isEqual(nextIndexPatternIds, this._prevIndexPatternIds)) {
// all ready loaded index pattern ids
@ -118,9 +137,10 @@ export class GisMap extends Component {
() => {
if (this._isMounted) {
this.setState({ isInitialLoadRenderTimeoutComplete: true });
this._onInitialLoadRenderComplete();
}
},
1000
5000
);
}
@ -135,6 +155,8 @@ export class GisMap extends Component {
mapInitError,
} = this.props;
const { domId } = this.state;
if (mapInitError) {
return (
<div data-render-complete data-shared-item>
@ -179,6 +201,7 @@ export class GisMap extends Component {
<EuiFlexGroup
gutterSize="none"
responsive={false}
data-dom-id={domId}
data-render-complete={this.state.isInitialLoadRenderTimeoutComplete}
data-shared-item
>

View file

@ -4,8 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { Page, SerializableOrJSHandle, EvaluateFn } from 'puppeteer';
import { parse as parseUrl } from 'url';
import { Page, SerializableOrJSHandle, EvaluateFn } from 'puppeteer';
import { ViewZoomWidthHeight } from '../../../../export_types/common/layouts/layout';
import {
ConditionalHeaders,

View file

@ -6,14 +6,13 @@
import fs from 'fs';
import os from 'os';
import path from 'path';
// @ts-ignore
import puppeteer from 'puppeteer-core';
import { Browser, Page, LaunchOptions } from 'puppeteer';
import rimraf from 'rimraf';
import * as Rx from 'rxjs';
import { map, share, mergeMap, filter, partition, ignoreElements, tap } from 'rxjs/operators';
import { InnerSubscriber } from 'rxjs/internal/InnerSubscriber';
import { puppeteerLaunch } from '../puppeteer';
import { LevelLogger as Logger } from '../../../lib/level_logger';
import { HeadlessChromiumDriver } from '../driver';
import { args, IArgOptions } from './args';
@ -63,23 +62,21 @@ export class HeadlessChromiumDriverFactory {
proxyConfig: this.browserConfig.proxy,
});
return puppeteer
.launch({
userDataDir,
executablePath: this.binaryPath,
ignoreHTTPSErrors: true,
args: chromiumArgs,
env: {
TZ: browserTimezone,
},
} as LaunchOptions)
.catch((error: Error) => {
logger.warning(
`The Reporting plugin encountered issues launching Chromium in a self-test. You may have trouble generating reports: [${error}]`
);
logger.warning(`See Chromium's log output at "${getChromeLogLocation(this.binaryPath)}"`);
return null;
});
return puppeteerLaunch({
userDataDir,
executablePath: this.binaryPath,
ignoreHTTPSErrors: true,
args: chromiumArgs,
env: {
TZ: browserTimezone,
},
} as LaunchOptions).catch((error: Error) => {
logger.warning(
`The Reporting plugin encountered issues launching Chromium in a self-test. You may have trouble generating reports: [${error}]`
);
logger.warning(`See Chromium's log output at "${getChromeLogLocation(this.binaryPath)}"`);
return null;
});
}
create({
@ -109,8 +106,8 @@ export class HeadlessChromiumDriverFactory {
let browser: Browser;
let page: Page;
try {
browser = await puppeteer.launch({
pipe: true,
browser = await puppeteerLaunch({
pipe: !this.browserConfig.inspect,
userDataDir,
executablePath: this.binaryPath,
ignoreHTTPSErrors: true,
@ -126,7 +123,6 @@ export class HeadlessChromiumDriverFactory {
// which can cause the job to fail even if we bump timeouts in
// the config. Help alleviate errors like
// "TimeoutError: waiting for selector ".application" failed: timeout 30000ms exceeded"
// @ts-ignore outdated typedefs for puppteer
page.setDefaultTimeout(this.queueTimeout);
this.logger.debug(`Browser driver factory created`);

View file

@ -12,23 +12,23 @@ export const paths = {
packages: [
{
platforms: ['darwin', 'freebsd', 'openbsd'],
archiveFilename: 'chromium-2fac04a-darwin.zip',
archiveChecksum: '36814b1629457aa178b4ecdf6cc1bc5f',
rawChecksum: '9b40e2efa7f4f1870835ee4cdaf1dd51',
archiveFilename: 'chromium-312d84c-darwin.zip',
archiveChecksum: '020303e829745fd332ae9b39442ce570',
rawChecksum: '101dfea297c5818a7a3f3317a99dde02',
binaryRelativePath: 'headless_shell-darwin/headless_shell',
},
{
platforms: ['linux'],
archiveFilename: 'chromium-2fac04a-linux.zip',
archiveChecksum: '5cd6b898a35f9dc0ba6f49d821b8a2a3',
rawChecksum: 'b3fd218d3c3446c388da4e6c8a82754c',
archiveFilename: 'chromium-312d84c-linux.zip',
archiveChecksum: '15ba9166a42f93ee92e42217b737018d',
rawChecksum: '3455db62ea4bd2d6e891e9155313305a',
binaryRelativePath: 'headless_shell-linux/headless_shell',
},
{
platforms: ['win32'],
archiveFilename: 'chromium-2fac04a-windows.zip',
archiveChecksum: '1499a4d5847792d59b9c1a8ab7dc8b94',
rawChecksum: '08b48d2f3d23c4bc8b58779ca4a7b627',
archiveFilename: 'chromium-312d84c-windows.zip',
archiveChecksum: '3e36adfb755dacacc226ed5fd6b43105',
rawChecksum: 'ec7aa6cfecb172129474b447311275ec',
binaryRelativePath: 'headless_shell-windows\\headless_shell.exe',
},
],

View file

@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import puppeteer from 'puppeteer';
// @ts-ignore lacking typedefs which this module fixes
import puppeteerCore from 'puppeteer-core';
export const puppeteerLaunch: (
opts?: puppeteer.LaunchOptions
) => Promise<puppeteer.Browser> = puppeteerCore.launch.bind(puppeteerCore);

View file

@ -80,8 +80,8 @@
"@types/papaparse": "^4.5.5",
"@types/pngjs": "^3.3.1",
"@types/prop-types": "^15.5.3",
"@types/proper-lockfile": "^3.0.0",
"@types/puppeteer": "^1.12.4",
"@types/proper-lockfile": "^3.0.1",
"@types/puppeteer": "^1.19.0",
"@types/react": "^16.8.0",
"@types/react-dom": "^16.8.0",
"@types/react-redux": "^6.0.6",
@ -304,7 +304,7 @@
"prop-types": "^15.6.0",
"proper-lockfile": "^3.0.2",
"puid": "1.0.7",
"puppeteer-core": "^1.13.0",
"puppeteer-core": "^1.19.0",
"raw-loader": "3.1.0",
"react": "^16.8.0",
"react-apollo": "^2.1.4",

View file

@ -3813,12 +3813,19 @@
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.5.9.tgz#f2d14df87b0739041bc53a7d75e3d77d726a3ec0"
integrity sha512-Nha5b+jmBI271jdTMwrHiNXM+DvThjHOfyZtMX9kj/c/LUj2xiLHsG/1L3tJ8DjAoQN48cHwUwtqBotjyXaSdQ==
"@types/proper-lockfile@^3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@types/proper-lockfile/-/proper-lockfile-3.0.0.tgz#dcc7cc3714857a4ae6583331d2687e89dc5c94d2"
integrity sha512-+tfnsA3KNPDm7Sj9x5omRgvS6ALc+edjTZXYeR3kVEm+qmsrF+59yJUWZDreV/O0+EQ6t0YSWlzxfdV58UOEVg==
"@types/proper-lockfile@^3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@types/proper-lockfile/-/proper-lockfile-3.0.1.tgz#dd770a2abce3adbcce3bd1ed892ce2f5f17fbc86"
integrity sha512-ODOjqxmaNs0Zkij+BJovsNJRSX7BJrr681o8ZnNTNIcTermvVFzLpz/XFtfg3vNrlPVTJY1l4e9h2LvHoxC1lg==
"@types/puppeteer@^1.12.4", "@types/puppeteer@^1.6.0":
"@types/puppeteer@^1.19.0":
version "1.19.0"
resolved "https://registry.yarnpkg.com/@types/puppeteer/-/puppeteer-1.19.0.tgz#59f0050bae019cee7c3af2bb840a25892a3078b6"
integrity sha512-Db9LWOuTm2bR/qgPE7PQCmnsCQ6flHdULuIDWTks8YdQ/SGHKg5WGWG54gl0734NDKCTF5MbqAp2qWuvBiyQ3Q==
dependencies:
"@types/node" "*"
"@types/puppeteer@^1.6.0":
version "1.12.4"
resolved "https://registry.yarnpkg.com/@types/puppeteer/-/puppeteer-1.12.4.tgz#8388efdb0b30a54a7e7c4831ca0d709191d77ff1"
integrity sha512-aaGbJaJ9TuF9vZfTeoh876sBa+rYJWPwtsmHmYr28pGr42ewJnkDTq2aeSKEmS39SqUdkwLj73y/d7rBSp7mDQ==
@ -22543,10 +22550,10 @@ punycode@^1.2.4, punycode@^1.4.1:
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e"
integrity sha1-wNWmOycYgArY4esPpSachN1BhF4=
puppeteer-core@^1.13.0:
version "1.13.0"
resolved "https://registry.yarnpkg.com/puppeteer-core/-/puppeteer-core-1.13.0.tgz#f8001851e924e6e9ef6e9fae1778c3ab87c3f307"
integrity sha512-8MypjWVHu2EEdtN2HxhCsTtIYdJgiCcbGpHoosv265fzanfOICC2/DadLZq6/Qc/OKsovQmjkO+2vKMrV3BRfA==
puppeteer-core@^1.19.0:
version "1.19.0"
resolved "https://registry.yarnpkg.com/puppeteer-core/-/puppeteer-core-1.19.0.tgz#3c3f98edb5862583e3a9c19cbc0da57ccc63ba5c"
integrity sha512-ZPbbjUymorIJomHBvdZX5+2gciUmQtAdepCrkweHH6rMJr96xd/dXzHgmYEOBMatH44SmJrcMtWkgsLHJqT89g==
dependencies:
debug "^4.1.0"
extract-zip "^1.6.6"