[8.11] fix(NA): getPluginsDistFromRepo to return only dist plugins on build (#171457) (#171504)

# Backport

This will backport the following commits from `main` to `8.11`:
- [fix(NA): getPluginsDistFromRepo to return only dist plugins on build
(#171457)](https://github.com/elastic/kibana/pull/171457)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Tiago
Costa","email":"tiago.costa@elastic.co"},"sourceCommit":{"committedDate":"2023-11-20T09:52:53Z","message":"fix(NA):
getPluginsDistFromRepo to return only dist plugins on build
(#171457)\n\nThis PR fixes a problem where the `getPluginsDistFromRepo`
would return\r\nevery available plugin and not only the dist
ones.","sha":"92b6b82d1c9c35db82af3c0d9f7e9c18a68483c8","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["chore","Team:Operations","release_note:skip","backport:prev-minor","v8.12.0"],"number":171457,"url":"https://github.com/elastic/kibana/pull/171457","mergeCommit":{"message":"fix(NA):
getPluginsDistFromRepo to return only dist plugins on build
(#171457)\n\nThis PR fixes a problem where the `getPluginsDistFromRepo`
would return\r\nevery available plugin and not only the dist
ones.","sha":"92b6b82d1c9c35db82af3c0d9f7e9c18a68483c8"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/171457","number":171457,"mergeCommit":{"message":"fix(NA):
getPluginsDistFromRepo to return only dist plugins on build
(#171457)\n\nThis PR fixes a problem where the `getPluginsDistFromRepo`
would return\r\nevery available plugin and not only the dist
ones.","sha":"92b6b82d1c9c35db82af3c0d9f7e9c18a68483c8"}}]}] BACKPORT-->

Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
This commit is contained in:
Kibana Machine 2023-11-20 10:08:00 -05:00 committed by GitHub
parent 0e2d46d2cf
commit 0934f86f48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -251,6 +251,6 @@ export class Config {
}
getDistPluginsFromRepo() {
return getPackages(this.repoRoot).filter(this.pluginFilter);
return getPackages(this.repoRoot).filter((p) => !p.isDevOnly() && this.pluginFilter(p));
}
}

View file

@ -6,6 +6,7 @@
* Side Public License, v 1.
*/
import { PluginPackage } from '@kbn/repo-packages';
import { findUsedDependencies } from './find_used_dependencies';
import { read, write, Task } from '../../lib';
@ -13,7 +14,7 @@ export const CreatePackageJson: Task = {
description: 'Creating build-ready version of package.json',
async run(config, log, build) {
const plugins = config.getDistPluginsFromRepo();
const plugins = config.getDistPluginsFromRepo() as PluginPackage[];
const distPkgIds = new Set(config.getDistPackagesFromRepo().map((p) => p.id));
const pkg = config.getKibanaPkg();