-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fleet] Rely on package content during installation #142353
Conversation
@elasticmachine merge upstream |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
archivePath, | ||
verificationResult: latestVerificationResult, | ||
} = await withPackageSpan('Fetch package archive from registry', () => | ||
fetchArchiveBuffer({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function internally calls getInfo
to retrieve the ArchiveBuffer
:
kibana/x-pack/plugins/fleet/server/services/epm/registry/index.ts
Lines 312 to 330 in 4019d37
export async function fetchArchiveBuffer({ | |
pkgName, | |
pkgVersion, | |
shouldVerify, | |
ignoreUnverified = false, | |
}: { | |
pkgName: string; | |
pkgVersion: string; | |
shouldVerify: boolean; | |
ignoreUnverified?: boolean; | |
}): Promise<{ | |
archiveBuffer: Buffer; | |
archivePath: string; | |
verificationResult?: PackageVerificationResult; | |
}> { | |
const logger = appContextService.getLogger(); | |
const { download: archivePath } = await getInfo(pkgName, pkgVersion); | |
const archiveUrl = `${getRegistryUrl()}${archivePath}`; | |
const archiveBuffer = await getResponseStream(archiveUrl).then(streamToBuffer); |
I wonder if I should get the ArchiveBuffer
from the cache instead and remove the calls to getInfo
altogether.
Pinging @elastic/fleet (Team:Fleet) |
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes in x-pack/plugins/security_solution/server/lib/detection_engine/routes/fleet/get_installed_integrations/installed_integration_set.ts
LGTM 👍
@elasticmachine merge upstream |
@@ -49,7 +50,7 @@ export interface PackageClient { | |||
getRegistryPackage( | |||
packageName: string, | |||
packageVersion: string | |||
): Promise<{ packageInfo: RegistryPackage; paths: string[] }>; | |||
): Promise<{ packageInfo: ArchivePackage; paths: string[] }>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems weird to me that getRegistryPackage
return an ArchivePackage
should this be a new method, or should rename it getPackage
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calling it getPackage
would be a good option. I've been in doubt about the naming because the whole flow is in Registry
but it's not going to use the registry anymore.. I guess we'll have to refactor further
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the name to GetPackage
, I will need additional approvals from other teams that also use that method.
@elasticmachine merge upstream |
Pinging @elastic/apm-ui (Team:APM) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apm changes lgtm
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: cc @criamico |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code changes look good to me, thanks for this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OLM changes (getRegistryPackage rename) LGTM!
Summary
Closes #115032
Removing the call to
getInfo
inRegistry.getRegistryPackage
withgeneratePackageInfoFromArchiveBuffer
to reduce the dependency from the registry.Tests
node x-pack/plugins/fleet/scripts/install_all_packages/index.js
- Remember to add the static path to the kibana url if you use one:Checklist
Delete any items that are not applicable to this PR.