mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
* [kbn/pm] don't fail when plugins are outside repo * remove unused import Co-authored-by: spalger <spalger@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: spalger <spalger@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
dd378a9d31
commit
719dbe781a
5 changed files with 681 additions and 604 deletions
1244
packages/kbn-pm/dist/index.js
vendored
1244
packages/kbn-pm/dist/index.js
vendored
File diff suppressed because it is too large
Load diff
|
@ -48,6 +48,7 @@
|
|||
"globby": "^8.0.1",
|
||||
"has-ansi": "^3.0.0",
|
||||
"indent-string": "^3.2.0",
|
||||
"is-path-inside": "^3.0.2",
|
||||
"lodash.clonedeepwith": "^4.5.0",
|
||||
"log-symbols": "^2.2.0",
|
||||
"multimatch": "^4.0.0",
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
import Path from 'path';
|
||||
|
||||
import multimatch from 'multimatch';
|
||||
import isPathInside from 'is-path-inside';
|
||||
|
||||
import { ProjectMap, getProjects, includeTransitiveProjects } from './projects';
|
||||
import { Project } from './project';
|
||||
|
@ -121,4 +122,15 @@ export class Kibana {
|
|||
|
||||
return filteredProjects;
|
||||
}
|
||||
|
||||
isPartOfRepo(project: Project) {
|
||||
return (
|
||||
project.path === this.kibanaProject.path ||
|
||||
isPathInside(project.path, this.kibanaProject.path)
|
||||
);
|
||||
}
|
||||
|
||||
isOutsideRepo(project: Project) {
|
||||
return !this.isPartOfRepo(project);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,14 @@ async function getChangesForProjects(projects: ProjectMap, kbn: Kibana, log: Too
|
|||
|
||||
const { stdout } = await execa(
|
||||
'git',
|
||||
['ls-files', '-dmt', '--', ...Array.from(projects.values()).map(p => p.path)],
|
||||
[
|
||||
'ls-files',
|
||||
'-dmt',
|
||||
'--',
|
||||
...Array.from(projects.values())
|
||||
.filter(p => kbn.isPartOfRepo(p))
|
||||
.map(p => p.path),
|
||||
],
|
||||
{
|
||||
cwd: kbn.getAbsolute(),
|
||||
}
|
||||
|
@ -84,9 +91,14 @@ async function getChangesForProjects(projects: ProjectMap, kbn: Kibana, log: Too
|
|||
}
|
||||
|
||||
const sortedRelevantProjects = Array.from(projects.values()).sort(projectBySpecificitySorter);
|
||||
const changesByProject = new Map<Project, Changes>();
|
||||
const changesByProject = new Map<Project, Changes | undefined>();
|
||||
|
||||
for (const project of sortedRelevantProjects) {
|
||||
if (kbn.isOutsideRepo(project)) {
|
||||
changesByProject.set(project, undefined);
|
||||
continue;
|
||||
}
|
||||
|
||||
const ownChanges: Changes = new Map();
|
||||
const prefix = kbn.getRelative(project.path);
|
||||
|
||||
|
@ -114,6 +126,10 @@ async function getChangesForProjects(projects: ProjectMap, kbn: Kibana, log: Too
|
|||
|
||||
/** Get the latest commit sha for a project */
|
||||
async function getLatestSha(project: Project, kbn: Kibana) {
|
||||
if (kbn.isOutsideRepo(project)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { stdout } = await execa(
|
||||
'git',
|
||||
['log', '-n', '1', '--pretty=format:%H', '--', project.path],
|
||||
|
@ -175,7 +191,7 @@ function resolveDepsForProject(project: Project, yarnLock: YarnLock, kbn: Kibana
|
|||
*/
|
||||
async function getChecksum(
|
||||
project: Project,
|
||||
changes: Changes,
|
||||
changes: Changes | undefined,
|
||||
yarnLock: YarnLock,
|
||||
kbn: Kibana,
|
||||
log: ToolingLog
|
||||
|
@ -185,7 +201,7 @@ async function getChecksum(
|
|||
log.verbose(`[${project.name}] local sha:`, sha);
|
||||
}
|
||||
|
||||
if (Array.from(changes.values()).includes('invalid')) {
|
||||
if (!changes || Array.from(changes.values()).includes('invalid')) {
|
||||
log.warning(`[${project.name}] unable to determine local changes, caching disabled`);
|
||||
return;
|
||||
}
|
||||
|
@ -248,7 +264,7 @@ export async function getAllChecksums(kbn: Kibana, log: ToolingLog) {
|
|||
Array.from(projects.values()).map(async project => {
|
||||
cacheKeys.set(
|
||||
project.name,
|
||||
await getChecksum(project, changesByProject.get(project)!, yarnLock, kbn, log)
|
||||
await getChecksum(project, changesByProject.get(project), yarnLock, kbn, log)
|
||||
);
|
||||
})
|
||||
);
|
||||
|
|
|
@ -18257,7 +18257,7 @@ is-path-inside@^2.1.0:
|
|||
dependencies:
|
||||
path-is-inside "^1.0.2"
|
||||
|
||||
is-path-inside@^3.0.1:
|
||||
is-path-inside@^3.0.1, is-path-inside@^3.0.2:
|
||||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.2.tgz#f5220fc82a3e233757291dddc9c5877f2a1f3017"
|
||||
integrity sha512-/2UGPSgmtqwo1ktx8NDHjuPwZWmHhO+gj0f93EkhLB5RgW9RZevWYYlIkS6zePc6U2WpOdQYIwHe9YC4DWEBVg==
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue