Skip to content

Commit

Permalink
[PURIFY][BUILD] Removes most of x-pack references. (#257)
Browse files Browse the repository at this point in the history
* [PURIFY][BUILD] Removes most of x-pack referneces

Signed-off-by: Mihir Soni <mihirsoni.123@gmail.com>

* [PURIFY][BUILD] Addressed review comments

Signed-off-by: Mihir Soni <mihirsoni.123@gmail.com>
  • Loading branch information
mihirsoni authored Apr 8, 2021
1 parent b96ddd9 commit 85f13d3
Show file tree
Hide file tree
Showing 40 changed files with 26 additions and 701 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pipeline {
stage('bootstrap') {
echo "Bootstrap here"
sh 'yarn osd bootstrap'
sh 'node scripts/build_opensearch_dashboards_platform_plugins --oss --no-examples --workers 10'
sh 'node scripts/build_opensearch_dashboards_platform_plugins --no-examples --workers 10'
}
}
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ test('parses single line', () => {

test('parses multiple lines', () => {
const data = dedent(`
[2018-02-23T10:13:40,405][INFO ][o.e.p.PluginsService ] [qEfPPg8] loaded plugin [x-pack-security]
[2018-02-23T10:13:40,405][INFO ][o.e.p.PluginsService ] [qEfPPg8] loaded plugin [x-pack-watcher]
[2018-02-23T10:13:40,405][INFO ][o.e.p.PluginsService ] [qEfPPg8] loaded plugin [osd-security]
[2018-02-23T10:13:40,405][INFO ][o.e.p.PluginsService ] [qEfPPg8] loaded plugin [osd-watcher]
`);

const lines = parseOpenSearchLog(data);
Expand Down

This file was deleted.

This file was deleted.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ afterAll(async () => {
it('builds expected bundles, saves bundle counts to metadata', async () => {
const config = OptimizerConfig.create({
repoRoot: MOCK_REPO_DIR,
pluginScanDirs: [Path.resolve(MOCK_REPO_DIR, 'plugins'), Path.resolve(MOCK_REPO_DIR, 'x-pack')],
pluginScanDirs: [Path.resolve(MOCK_REPO_DIR, 'plugins')],
maxWorkerCount: 1,
dist: false,
});
Expand Down Expand Up @@ -111,7 +111,7 @@ it('builds expected bundles, saves bundle counts to metadata', async () => {
(msg.event?.type === 'bundle cached' || msg.event?.type === 'bundle not cached') &&
msg.state.phase === 'initializing'
);
assert('produce three bundle cache events while initializing', bundleCacheStates.length === 3);
assert('produce two bundle cache events while initializing', bundleCacheStates.length === 2);

const initializedStates = msgs.filter((msg) => msg.state.phase === 'initialized');
assert('produce at least one initialized event', initializedStates.length >= 1);
Expand All @@ -126,7 +126,7 @@ it('builds expected bundles, saves bundle counts to metadata', async () => {
);

const bundleNotCachedEvents = msgs.filter((msg) => msg.event?.type === 'bundle not cached');
assert('produce three "bundle not cached" events', bundleNotCachedEvents.length === 3);
assert('produce two "bundle not cached" events', bundleNotCachedEvents.length === 2);

const successStates = msgs.filter((msg) => msg.state.phase === 'success');
assert(
Expand Down Expand Up @@ -185,26 +185,12 @@ it('builds expected bundles, saves bundle counts to metadata', async () => {
<absolute path>/packages/osd-ui-shared-deps/public_path_module_creator.js,
]
`);

const baz = config.bundles.find((b) => b.id === 'baz')!;
expect(baz).toBeTruthy();
baz.cache.refresh();
expect(baz.cache.getModuleCount()).toBe(3);

expect(baz.cache.getReferencedFiles()).toMatchInlineSnapshot(`
Array [
<absolute path>/packages/osd-optimizer/src/__fixtures__/__tmp__/mock_repo/x-pack/baz/opensearch_dashboards.json,
<absolute path>/packages/osd-optimizer/src/__fixtures__/__tmp__/mock_repo/x-pack/baz/public/index.ts,
<absolute path>/packages/osd-optimizer/target/worker/entry_point_creator.js,
<absolute path>/packages/osd-ui-shared-deps/public_path_module_creator.js,
]
`);
});

it('uses cache on second run and exist cleanly', async () => {
const config = OptimizerConfig.create({
repoRoot: MOCK_REPO_DIR,
pluginScanDirs: [Path.resolve(MOCK_REPO_DIR, 'plugins'), Path.resolve(MOCK_REPO_DIR, 'x-pack')],
pluginScanDirs: [Path.resolve(MOCK_REPO_DIR, 'plugins')],
maxWorkerCount: 1,
dist: false,
});
Expand All @@ -225,7 +211,6 @@ it('uses cache on second run and exist cleanly', async () => {
"initializing",
"initializing",
"initializing",
"initializing",
"initialized",
"success",
]
Expand All @@ -235,7 +220,7 @@ it('uses cache on second run and exist cleanly', async () => {
it('prepares assets for distribution', async () => {
const config = OptimizerConfig.create({
repoRoot: MOCK_REPO_DIR,
pluginScanDirs: [Path.resolve(MOCK_REPO_DIR, 'plugins'), Path.resolve(MOCK_REPO_DIR, 'x-pack')],
pluginScanDirs: [Path.resolve(MOCK_REPO_DIR, 'plugins')],
maxWorkerCount: 1,
dist: true,
});
Expand All @@ -248,7 +233,6 @@ it('prepares assets for distribution', async () => {
'foo async bundle'
);
expectFileMatchesSnapshotWithCompression('plugins/bar/target/public/bar.plugin.js', 'bar bundle');
expectFileMatchesSnapshotWithCompression('x-pack/baz/target/public/baz.plugin.js', 'baz bundle');
});

/**
Expand Down
3 changes: 0 additions & 3 deletions packages/osd-optimizer/src/node/node_auto_tranpilation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ const IGNORE_PATTERNS = [
// is `x-pack` and `b` is not `node_modules`
/[\/\\]node_modules[\/\\](?!x-pack[\/\\](?!node_modules)([^\/\\]+))([^\/\\]+[\/\\][^\/\\]+)/,

// ignore paths matching `/canvas/canvas_plugin/`
/[\/\\]canvas[\/\\]canvas_plugin[\/\\]/,

// ignore any path in the packages, unless it is in the package's
// root `src` directory, in any test or __tests__ directory, or it
// ends with .test.js, .test.ts, or .test.tsx
Expand Down
21 changes: 0 additions & 21 deletions packages/osd-optimizer/src/optimizer/get_plugin_bundles.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,6 @@ it('returns a bundle for core and each plugin', () => {
extraPublicDirs: [],
manifestPath: '/outside/of/repo/plugins/baz/opensearch_dashboards.json',
},
{
directory: '/repo/x-pack/plugins/box',
id: 'box',
isUiPlugin: true,
extraPublicDirs: [],
manifestPath: '/repo/x-pack/plugins/box/opensearch_dashboards.json',
},
],
'/repo',
'/output'
Expand Down Expand Up @@ -87,20 +80,6 @@ it('returns a bundle for core and each plugin', () => {
"sourceRoot": <repoRoot>,
"type": "plugin",
},
Object {
"banner": "/*! 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. */
",
"contextDir": <repoRoot>/x-pack/plugins/box,
"id": "box",
"manifestPath": <repoRoot>/x-pack/plugins/box/opensearch_dashboards.json,
"outputDir": <outputRoot>/x-pack/plugins/box/target/public,
"publicDirNames": Array [
"public",
],
"sourceRoot": <repoRoot>,
"type": "plugin",
},
]
`);
});
7 changes: 1 addition & 6 deletions packages/osd-optimizer/src/optimizer/get_plugin_bundles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ export function getPluginBundles(
repoRoot: string,
outputRoot: string
) {
const xpackDirSlash = Path.resolve(repoRoot, 'x-pack') + Path.sep;

return plugins
.filter((p) => p.isUiPlugin)
.map(
Expand All @@ -46,10 +44,7 @@ export function getPluginBundles(
'target/public'
),
manifestPath: p.manifestPath,
banner: p.directory.startsWith(xpackDirSlash)
? `/*! Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one or more contributor license agreements.\n` +
` * Licensed under the Elastic License; you may not use this file except in compliance with the Elastic License. */\n`
: undefined,
banner: undefined,
})
);
}
1 change: 0 additions & 1 deletion packages/osd-pm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ function help() {

-e, --exclude Exclude specified project. Can be specified multiple times to exclude multiple projects, e.g. '-e opensearch-dashboards -e @osd/pm'.
-i, --include Include only specified projects. If left unspecified, it defaults to including all projects.
--oss Do not include the x-pack when running command.
--skip-opensearch-dashboards-plugins Filter all plugins in ./plugins and ../opensearch-dashboards-extra when running command.
--no-cache Disable the bootstrap cache
--verbose Set log level to verbose
Expand Down
1 change: 0 additions & 1 deletion packages/osd-pm/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ function help() {
-e, --exclude Exclude specified project. Can be specified multiple times to exclude multiple projects, e.g. '-e opensearch-dashboards -e @osd/pm'.
-i, --include Include only specified projects. If left unspecified, it defaults to including all projects.
--oss Do not include the x-pack when running command.
--skip-opensearch-dashboards-plugins Filter all plugins in ./plugins and ../opensearch-dashboards-extra when running command.
--no-cache Disable the bootstrap cache
--verbose Set log level to verbose
Expand Down
1 change: 0 additions & 1 deletion packages/osd-spec-to-console/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ git pull --depth=1 origin master

### Usage

You need to run the command twice: once for the **OSS** specs and once for the **X-Pack** specs
At the root of the OpenSearch Dashboards repository, run the following commands:

```sh
Expand Down
2 changes: 1 addition & 1 deletion packages/osd-telemetry-tools/GUIDELINE.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ node scripts/telemetry_check.js --path=<relative_path_to_collector>.ts

### 1. Update the telemetryrc file

Make sure your collector is not excluded in the `telemetryrc.json` files (located at the root of the OpenSearch Dashboards project, and another on in the `x-pack` dir).
Make sure your collector is not excluded in the `telemetryrc.json` file located at the root of the OpenSearch Dashboards project.

```s
[
Expand Down
2 changes: 1 addition & 1 deletion packages/osd-telemetry-tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ What will not be caught by the validator:

* Fields in the schema that are never collected. If you are trying to report a field from OpenSearch but that value is never stored in OpenSearch, the check will not be able to detect if that field is ever collected in the first palce. It is advised to add unit/functional tests to check that all the fields are being reported as expected.

The tool looks for `.telemetryrc.json` files in the root of the project and in the `x-pack` dir for its runtime configurations.
The tool looks for `.telemetryrc.json` files in the root of the project for its runtime configurations.

Currently auto-fixer (`--fix`) can automatically fix the json files with the following errors:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ import { TaskContext } from './task_context';

export function parseConfigsTask() {
const opensearchDashboardsRoot = process.cwd();
const xpackRoot = path.join(opensearchDashboardsRoot, 'x-pack');

const configRoots = [opensearchDashboardsRoot, xpackRoot];
const configRoots = [opensearchDashboardsRoot];

return configRoots.map((configRoot) => ({
task: async (context: TaskContext) => {
Expand Down
4 changes: 2 additions & 2 deletions src/cli_plugin/install/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ export function installCommand(program) {
.description(
'install a plugin',
`Common examples:
install file:///Path/to/my/x-pack.zip
install https://path.to/my/x-pack.zip`
install file:///Path/to/my/plugin-example.zip
install https://path.to/my/plugin-example.zip`
)
.action(processCommand);
}
3 changes: 0 additions & 3 deletions src/cli_plugin/install/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,12 @@ import { download } from './download';
import { cleanPrevious, cleanArtifacts } from './cleanup';
import { extract, getPackData } from './pack';
import { renamePlugin } from './rename';
import { errorIfXPackInstall } from '../lib/error_if_x_pack';
import { existingInstall, assertVersion } from './opensearch_dashboards';

const mkdir = promisify(Fs.mkdir);

export async function install(settings, logger) {
try {
errorIfXPackInstall(settings, logger);

await cleanPrevious(settings, logger);

await mkdir(settings.workingPath, { recursive: true });
Expand Down
48 changes: 0 additions & 48 deletions src/cli_plugin/lib/error_if_x_pack.js

This file was deleted.

50 changes: 0 additions & 50 deletions src/cli_plugin/lib/error_if_x_pack.test.js

This file was deleted.

Loading

0 comments on commit 85f13d3

Please sign in to comment.