mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[build] Remove chat solution from stateful artifacts (#215430)
Removes `private` packages in the `chat` group from releasable artifacts. In order to facilitate functional tests against the chat solution, we will not remove packages in snapshot builds until https://github.com/elastic/kibana/issues/215582 is completed. Closes https://github.com/elastic/kibana/issues/213468
This commit is contained in:
parent
7c4af051b2
commit
6697d9ab7d
7 changed files with 67 additions and 5 deletions
|
@ -18,6 +18,7 @@ import {
|
|||
PluginPackage,
|
||||
getPluginPackagesFilter,
|
||||
} from '@kbn/repo-packages';
|
||||
import { type KibanaProject } from '@kbn/projects-solutions-groups';
|
||||
|
||||
import { getVersionInfo, VersionInfo } from './version_info';
|
||||
import {
|
||||
|
@ -275,4 +276,10 @@ export class Config {
|
|||
getDistPluginsFromRepo() {
|
||||
return getPackages(this.repoRoot).filter((p) => !p.isDevOnly() && this.pluginFilter(p));
|
||||
}
|
||||
|
||||
getPrivateSolutionPackagesFromRepo(project: KibanaProject) {
|
||||
return getPackages(this.repoRoot).filter(
|
||||
(p) => p.group === project && p.visibility === 'private'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
*/
|
||||
|
||||
import { REPO_ROOT } from '@kbn/repo-info';
|
||||
import { resolve } from 'path';
|
||||
import { removePackagesFromPackageMap } from '@kbn/repo-packages';
|
||||
import { resolve, join } from 'path';
|
||||
import { scanCopy, Task, deleteAll, copyAll } from '../lib';
|
||||
import { getNodeDownloadInfo } from './nodejs';
|
||||
|
||||
|
@ -56,9 +57,27 @@ export const CreateArchivesSources: Task = {
|
|||
select: ['serverless.yml', 'serverless.{es,oblt,security}.yml'],
|
||||
}
|
||||
);
|
||||
log.debug(
|
||||
`Serverless adjustments made in serverless-${platform.getNodeArch()} specific build directory`
|
||||
log.debug(`Adjustments made in serverless specific build directory`);
|
||||
|
||||
// Remove chat solution from release artifacts
|
||||
// For now, snapshot builds support all solutions to faciliate functional testing
|
||||
} else if (config.isRelease) {
|
||||
const chatPlugins = config.getPrivateSolutionPackagesFromRepo('chat');
|
||||
const chatPluginNames = chatPlugins.map((p) => p.name);
|
||||
const chatPluginsPaths = chatPluginNames.map((name) =>
|
||||
build.resolvePathForPlatform(platform, join('node_modules', name))
|
||||
);
|
||||
log.debug('Removing plugins: ' + chatPluginNames.join(','));
|
||||
await deleteAll(chatPluginsPaths, log);
|
||||
|
||||
removePackagesFromPackageMap(
|
||||
chatPluginNames,
|
||||
build.resolvePathForPlatform(
|
||||
platform,
|
||||
'node_modules/@kbn/repo-packages/package-map.json'
|
||||
)
|
||||
);
|
||||
log.debug(`Adjustments made in stateful specific build directory`);
|
||||
}
|
||||
})
|
||||
);
|
||||
|
|
|
@ -26,6 +26,7 @@ const {
|
|||
getPkgDirMap,
|
||||
getPkgsById,
|
||||
updatePackageMap,
|
||||
removePackagesFromPackageMap,
|
||||
readHashOfPackageMap,
|
||||
readPackageMap,
|
||||
} = require('./modern/get_packages');
|
||||
|
@ -45,6 +46,7 @@ module.exports = {
|
|||
getPkgDirMap,
|
||||
getPkgsById,
|
||||
updatePackageMap,
|
||||
removePackagesFromPackageMap,
|
||||
findPackageForPath,
|
||||
readPackageManifest,
|
||||
Jsonc,
|
||||
|
|
|
@ -26,10 +26,24 @@ const CACHE = new Map();
|
|||
|
||||
/**
|
||||
* Read the pkgmap from disk and parse it into a Map
|
||||
* @param {string=} packageMapPath
|
||||
* @returns {Map<string, string>}
|
||||
*/
|
||||
function readPackageMap() {
|
||||
return new Map(JSON.parse(Fs.readFileSync(PACKAGE_MAP_PATH, 'utf8')));
|
||||
function readPackageMap(packageMapPath) {
|
||||
return new Map(JSON.parse(Fs.readFileSync(packageMapPath || PACKAGE_MAP_PATH, 'utf8')));
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes packages from the package map
|
||||
* @param {string[]} names
|
||||
* @param {string=} packageMapPath
|
||||
*/
|
||||
function removePackagesFromPackageMap(names, packageMapPath) {
|
||||
const path = packageMapPath || PACKAGE_MAP_PATH;
|
||||
const map = readPackageMap(path);
|
||||
names.forEach((name) => map.delete(name));
|
||||
const newContent = JSON.stringify(Array.from(map));
|
||||
Fs.writeFileSync(path, newContent);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -202,6 +216,7 @@ module.exports = {
|
|||
getPkgDirMap,
|
||||
getPkgsById,
|
||||
updatePackageMap,
|
||||
removePackagesFromPackageMap,
|
||||
findPackageForPath,
|
||||
readPackageMap,
|
||||
readHashOfPackageMap,
|
||||
|
|
|
@ -14,3 +14,4 @@
|
|||
- assert_kibana_available
|
||||
- assert_kibana_log
|
||||
- assert_kibana_data
|
||||
- assert_chat_plugin
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
- name: stat /usr/share/kibana/node_modules/@kbn/serverless-chat
|
||||
become: yes
|
||||
register: chat_plugin_directory
|
||||
stat:
|
||||
path: /usr/share/kibana/node_modules/@kbn/serverless-chat
|
||||
|
||||
- name: /usr/share/kibana/node_modules/@kbn/serverless-chat exists for snapshots
|
||||
assert:
|
||||
that:
|
||||
- chat_plugin_directory.stat.exists
|
||||
when: lookup('ansible.builtin.env', 'RELEASE_BUILD') != 'true'
|
||||
|
||||
- name: /usr/share/kibana/node_modules/@kbn/serverless-chat does not exist for releases
|
||||
assert:
|
||||
that:
|
||||
- not chat_plugin_directory.stat.exists
|
||||
when: lookup('ansible.builtin.env', 'RELEASE_BUILD') == 'true'
|
|
@ -14,3 +14,4 @@
|
|||
- assert_kibana_available
|
||||
- assert_kibana_log
|
||||
- assert_kibana_data
|
||||
- assert_chat_plugin
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue