Skip to content

Commit

Permalink
Restores task for downloading Chromium builds (#71749)
Browse files Browse the repository at this point in the history
This was removed in #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 <tyler.smalley@elastic.co>
  • Loading branch information
Tyler Smalley authored Jul 15, 2020
1 parent 8bcecc0 commit f0b4986
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .ci/packer_cache_for_branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)")"
Expand Down
2 changes: 2 additions & 0 deletions x-pack/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
test: testTask,
'test:karma': testKarmaTask,
'test:karma:debug': testKarmaDebugTask,
Expand Down
26 changes: 26 additions & 0 deletions x-pack/tasks/download_chromium.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* 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);
};

0 comments on commit f0b4986

Please sign in to comment.