From af983a402d5d4ba91d63152e402674cb9bcc04f8 Mon Sep 17 00:00:00 2001 From: Tyler Smalley Date: Tue, 14 Jul 2020 13:33:02 -0700 Subject: [PATCH 1/3] Restores task for downloading Chromium builds This was removed in https://github.com/elastic/kibana/pull/69165 without realizing it was used by the packer cache. I renamed it to be more inline with what it actually does. Signed-off-by: Tyler Smalley --- .ci/packer_cache_for_branch.sh | 2 +- x-pack/gulpfile.js | 2 ++ x-pack/tasks/download_chromium.ts | 27 +++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 x-pack/tasks/download_chromium.ts diff --git a/.ci/packer_cache_for_branch.sh b/.ci/packer_cache_for_branch.sh index 5b4a94be50fa2..ab0ab845b2dc3 100755 --- a/.ci/packer_cache_for_branch.sh +++ b/.ci/packer_cache_for_branch.sh @@ -18,7 +18,7 @@ node scripts/es snapshot --download-only; node scripts/es snapshot --license=oss --download-only; # download reporting browsers -(cd "x-pack" && yarn gulp prepare); +(cd "x-pack" && yarn gulp downloadChromium); # cache the chromedriver archive chromedriverDistVersion="$(node -e "console.log(require('chromedriver').version)")" diff --git a/x-pack/gulpfile.js b/x-pack/gulpfile.js index adccaccecd7da..c560f3b44042c 100644 --- a/x-pack/gulpfile.js +++ b/x-pack/gulpfile.js @@ -9,11 +9,13 @@ require('../src/setup_node_env'); const { buildTask } = require('./tasks/build'); const { devTask } = require('./tasks/dev'); const { testTask, testKarmaTask, testKarmaDebugTask } = require('./tasks/test'); +const { downloadChromium } = require('./tasks/download_chromium'); // export the tasks that are runnable from the CLI module.exports = { build: buildTask, dev: devTask, + downloadChromium: downloadChromium, test: testTask, 'test:karma': testKarmaTask, 'test:karma:debug': testKarmaDebugTask, diff --git a/x-pack/tasks/download_chromium.ts b/x-pack/tasks/download_chromium.ts new file mode 100644 index 0000000000000..6cbf9e5e39ceb --- /dev/null +++ b/x-pack/tasks/download_chromium.ts @@ -0,0 +1,27 @@ +/* + * 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 { LevelLogger } from '../plugins/reporting/server/lib'; +import { ensureBrowserDownloaded } from '../plugins/reporting/server/browsers/download'; + + +export const downloadChromium = async () => { + // eslint-disable-next-line no-console + const consoleLogger = (tag: string) => (message: unknown) => console.log(tag, message); + const innerLogger = { + get: () => innerLogger, + debug: consoleLogger('debug'), + info: consoleLogger('info'), + warn: consoleLogger('warn'), + trace: consoleLogger('trace'), + error: consoleLogger('error'), + fatal: consoleLogger('fatal'), + log: consoleLogger('log'), + }; + + const levelLogger = new LevelLogger(innerLogger); + await ensureBrowserDownloaded(levelLogger); +}; \ No newline at end of file From 7738fcb15c9b8ad655735f597dd5fc865630ee69 Mon Sep 17 00:00:00 2001 From: Tyler Smalley Date: Tue, 14 Jul 2020 13:52:04 -0700 Subject: [PATCH 2/3] ESLint fix Signed-off-by: Tyler Smalley --- x-pack/tasks/download_chromium.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/x-pack/tasks/download_chromium.ts b/x-pack/tasks/download_chromium.ts index 6cbf9e5e39ceb..1f7f8a92dfffb 100644 --- a/x-pack/tasks/download_chromium.ts +++ b/x-pack/tasks/download_chromium.ts @@ -7,7 +7,6 @@ import { LevelLogger } from '../plugins/reporting/server/lib'; import { ensureBrowserDownloaded } from '../plugins/reporting/server/browsers/download'; - export const downloadChromium = async () => { // eslint-disable-next-line no-console const consoleLogger = (tag: string) => (message: unknown) => console.log(tag, message); @@ -24,4 +23,4 @@ export const downloadChromium = async () => { const levelLogger = new LevelLogger(innerLogger); await ensureBrowserDownloaded(levelLogger); -}; \ No newline at end of file +}; From e92538a458291eaf749c6f034d64401801a7e0fc Mon Sep 17 00:00:00 2001 From: Tyler Smalley Date: Tue, 14 Jul 2020 13:53:54 -0700 Subject: [PATCH 3/3] Feedback Signed-off-by: Tyler Smalley --- x-pack/gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/gulpfile.js b/x-pack/gulpfile.js index c560f3b44042c..7e5ab9b18f019 100644 --- a/x-pack/gulpfile.js +++ b/x-pack/gulpfile.js @@ -15,7 +15,7 @@ const { downloadChromium } = require('./tasks/download_chromium'); module.exports = { build: buildTask, dev: devTask, - downloadChromium: downloadChromium, + downloadChromium, test: testTask, 'test:karma': testKarmaTask, 'test:karma:debug': testKarmaDebugTask,