kibana/x-pack/tasks/build.ts
Tyler Smalley afe785b43a
[build] Creates Linux aarch64 archive (#69165)
- Updates Linux Chromium builds to accept architecture argument (defaults to x64) for arm64 support.
  - Example: `python ~/chromium/build_chromium/build.py 312d84c8ce62810976feda0d3457108a6dfff9e6 arm64`
- Updates all Chromium builds to include architecture in filename. 
  - `chromium-312d84c-linux_arm64.zip` _(new)_
  - `chromium-312d84c-linux.zip` > `chromium-312d84c-linux_x64.zip`
- Moves Chromium install from data directory to `x-pack/plugins/reporting/chromium`
- Moves Chromium download cache from `x-pack/plugins/reporting/.chromium` to `.chromium`
- Installs Chromium during build (closes #53664)
- Updates build to be architecture aware (x64 and aarch64)
- Removed Chromium debug logs, they were not helpful and can not be written inside the Kibana root. If we were to keep them, we would need to write to `logging.dist`.

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2020-07-09 19:42:48 -07:00

83 lines
2.3 KiB
TypeScript

/*
* 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 execa from 'execa';
import { resolve } from 'path';
import { writeFileSync } from 'fs';
import * as pluginHelpers from '@kbn/plugin-helpers';
import { ToolingLog, REPO_ROOT } from '@kbn/dev-utils';
import gulp from 'gulp';
import del from 'del';
import fancyLog from 'fancy-log';
import chalk from 'chalk';
import { generateNoticeFromSource } from '../../src/dev/notice';
import { gitInfo } from './helpers/git_info';
import { PKG_NAME } from './helpers/pkg';
import { BUILD_VERSION } from './helpers/build_version';
const XPACK_DIR = resolve(REPO_ROOT, 'x-pack');
const BUILD_DIR = resolve(XPACK_DIR, 'build');
const PLUGIN_BUILD_DIR = resolve(BUILD_DIR, 'plugin');
async function cleanBuildTask() {
fancyLog('Deleting', BUILD_DIR);
await del(BUILD_DIR);
fancyLog('[canvas] Deleting Shareable Runtime');
await del(resolve(XPACK_DIR, 'plugins/canvas/shareable_runtime/build'));
}
async function reportTask() {
const info = await gitInfo();
fancyLog('Package Name', chalk.yellow(PKG_NAME));
fancyLog('Version', chalk.yellow(BUILD_VERSION));
fancyLog('Build Number', chalk.yellow(`${info.number}`));
fancyLog('Build SHA', chalk.yellow(info.sha));
}
async function pluginHelpersBuild() {
await pluginHelpers.run('build', {
skipArchive: true,
buildDestination: PLUGIN_BUILD_DIR,
});
}
async function buildCanvasShareableRuntime() {
await execa(process.execPath, ['plugins/canvas/scripts/shareable_runtime'], {
cwd: XPACK_DIR,
stdio: ['ignore', 'inherit', 'inherit'],
// @ts-ignore Incorrect @types - execa supports `buffer`
buffer: false,
});
}
async function generateNoticeText() {
const buildRoot = resolve(PLUGIN_BUILD_DIR, 'kibana/x-pack');
const log = new ToolingLog({
level: 'info',
writeTo: process.stdout,
});
writeFileSync(
resolve(buildRoot, 'NOTICE.txt'),
await generateNoticeFromSource({
productName: 'Kibana X-Pack',
log,
directory: buildRoot,
})
);
}
export const buildTask = gulp.series(
cleanBuildTask,
reportTask,
buildCanvasShareableRuntime,
pluginHelpersBuild,
generateNoticeText
);