Removing the code plugin entirely for 8.0 (#77940)

* Removing the code app entirely for 8.0

* Updating plugin list docs

* Using a test plugin for the code_coverage integration tests

* Fix borked test.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Tre' Seymour <wayne.seymour@elastic.co>
This commit is contained in:
Brandon Kobel 2021-02-10 15:32:29 -08:00 committed by GitHub
parent 9fe8ccce47
commit 8c4af6fc5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 45 additions and 119 deletions

View file

@ -318,10 +318,6 @@ Failure to have auth enabled in Kibana will make for a broken UI. UI-based error
|The cloud plugin adds cloud specific features to Kibana.
|{kib-repo}blob/{branch}/x-pack/plugins/code[code]
|WARNING: Missing README.
|{kib-repo}blob/{branch}/x-pack/plugins/console_extensions/README.md[consoleExtensions]
|This plugin provides autocomplete definitions of licensed APIs to the OSS Console plugin.

View file

@ -0,0 +1,6 @@
{
"id": "codeCoverageTestPlugin",
"version": "kibana",
"server": true,
"ui": false
}

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
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { Plugin } from './plugin';
export function plugin() {
return new Plugin();
}

View file

@ -0,0 +1,23 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { CoreSetup } from 'kibana/server';
export class Plugin {
constructor() {}
public setup(core: CoreSetup) {}
public start() {
// called after all plugins are set up
}
public stop() {
// called when plugin is torn down during Kibana's shutdown sequence
}
}

View file

@ -3,4 +3,4 @@
# For more info, see https://help.github.com/articles/about-codeowners/
# App
/x-pack/plugins/code/ @elastic/kibana-tre
/src/dev/code_coverage/ingest_coverage/integration_tests/fixtures/test_plugin @elastic/kibana-tre

View file

@ -39,11 +39,8 @@ describe('Team Assignment', () => {
const { stdout } = await execa('grep', ['tre', teamAssignmentsPath], { cwd: ROOT_DIR });
const lines = stdout.split('\n').filter((line) => !line.includes('/target'));
expect(lines).toEqual([
'x-pack/plugins/code/jest.config.js kibana-tre',
'x-pack/plugins/code/server/config.ts kibana-tre',
'x-pack/plugins/code/server/index.ts kibana-tre',
'x-pack/plugins/code/server/plugin.test.ts kibana-tre',
'x-pack/plugins/code/server/plugin.ts kibana-tre',
'src/dev/code_coverage/ingest_coverage/integration_tests/fixtures/test_plugin/server/index.ts kibana-tre',
'src/dev/code_coverage/ingest_coverage/integration_tests/fixtures/test_plugin/server/plugin.ts kibana-tre',
]);
});
});

View file

@ -1,8 +0,0 @@
{
"id": "code",
"version": "8.0.0",
"kibanaVersion": "kibana",
"configPath": ["xpack", "code"],
"server": true,
"ui": false
}

View file

@ -1,14 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { schema } from '@kbn/config-schema';
const createCodeConfigSchema = () => {
return schema.any({ defaultValue: {} });
};
export const CodeConfigSchema = createCodeConfigSchema();

View file

@ -1,14 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { PluginInitializerContext } from 'src/core/server';
import { CodeConfigSchema } from './config';
import { CodePlugin } from './plugin';
export const config = { schema: CodeConfigSchema };
export const plugin = (initializerContext: PluginInitializerContext) =>
new CodePlugin(initializerContext);

View file

@ -1,39 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { coreMock } from '../../../../src/core/server/mocks';
import { CodePlugin } from './plugin';
describe('Code Plugin', () => {
describe('setup()', () => {
it('does not log deprecation message if no xpack.code.* configurations are set', async () => {
const context = coreMock.createPluginInitializerContext();
const plugin = new CodePlugin(context);
await plugin.setup();
expect(context.logger.get).not.toHaveBeenCalled();
});
it('logs deprecation message if any xpack.code.* configurations are set', async () => {
const context = coreMock.createPluginInitializerContext({
foo: 'bar',
});
const warn = jest.fn();
context.logger.get = jest.fn().mockReturnValue({ warn });
const plugin = new CodePlugin(context);
await plugin.setup();
expect(context.logger.get).toHaveBeenCalledWith('config', 'deprecation');
expect(warn.mock.calls[0][0]).toMatchInlineSnapshot(
`"The experimental app \\"Code\\" has been removed from Kibana. Remove all xpack.code.* configurations from kibana.yml so Kibana does not fail to start up in the next major version."`
);
});
});
});

View file

@ -1,34 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { TypeOf } from '@kbn/config-schema';
import { PluginInitializerContext, Plugin } from 'src/core/server';
import { CodeConfigSchema } from './config';
/**
* Represents Code Plugin instance that will be managed by the Kibana plugin system.
*/
export class CodePlugin implements Plugin {
constructor(private readonly initializerContext: PluginInitializerContext) {}
public async setup() {
const config = this.initializerContext.config.get<TypeOf<typeof CodeConfigSchema>>();
if (config && Object.keys(config).length > 0) {
this.initializerContext.logger
.get('config', 'deprecation')
.warn(
'The experimental app "Code" has been removed from Kibana. Remove all xpack.code.* ' +
'configurations from kibana.yml so Kibana does not fail to start up in the next major version.'
);
}
}
public start() {}
public stop() {}
}