Skip to content
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] return uploaded packages that are not in registry #150332

Merged
merged 1 commit into from
Feb 7, 2023

Conversation

juliaElastic
Copy link
Contributor

@juliaElastic juliaElastic commented Feb 6, 2023

Summary

Related to #148599
Fixes #81995

Changed GET /epm/packages API to list uploaded packages as well that are not in registry.

Testing steps:

  • Built a test package that is not in registry from kibana repo:
cd x-pack/test/fleet_api_integration/apis/fixtures/package_verification/packages/src/verified-1.0.0
elastic-package build --zip -v
curl -XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true' http://localhost:5601/julia/api/fleet/epm/packages -u elastic:changeme --data-binary @verified-1.0.0.zip
  • Navigate to Integrations page, verify that the Verified package is displayed under Browse / Installed integrations, and the details are visible when clicking on the package.

image

image

image

Checklist

@juliaElastic juliaElastic added release_note:skip Skip the PR/issue when compiling release notes v8.8.0 labels Feb 6, 2023
@juliaElastic juliaElastic self-assigned this Feb 6, 2023

const packagesNotInRegistry = packageSavedObjects.saved_objects
.filter((pkg) => !registryItems.some((item) => item.name === pkg.id))
.map((pkg) => createInstallableFrom({ ...pkg.attributes, title: nameAsTitle(pkg.id) }, pkg));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed that saved objects are missing title, description. So populating title as the capitalized name. E.g. 'my-package' -> 'My-package'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we get these info from the package manifest? maybe it has a big performance impact not sure.

Copy link
Contributor Author

@juliaElastic juliaElastic Feb 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably it's not a big impact as we would have only a few of these uploaded packages. Maybe this can be an enhancement, I think it is not critical for the feature.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raised #150409

@juliaElastic juliaElastic marked this pull request as ready for review February 6, 2023 14:38
@juliaElastic juliaElastic requested a review from a team as a code owner February 6, 2023 14:38
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Feb 6, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @juliaElastic

Copy link
Member

@nchaulet nchaulet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 🚀 probably worth creating an enhancement issue for https://github.com/elastic/kibana/pull/150332/files#r1097424505

@juliaElastic juliaElastic merged commit dd7ce28 into elastic:main Feb 7, 2023
@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.8 The branch "8.8" does not exist

Manual backport

To create the backport manually run:

node scripts/backport --pr 150332

Questions ?

Please refer to the Backport tool documentation

darnautov pushed a commit to darnautov/kibana that referenced this pull request Feb 7, 2023
…0332)

## Summary

Related to elastic#148599
Fixes elastic#81995

Changed `GET /epm/packages` API to list uploaded packages as well that
are not in registry.

Testing steps:
- Built a test package that is not in registry from kibana repo:
```
x-pack/test/fleet_api_integration/apis/fixtures/package_verification/packages/src/verified-1.0.0
elastic-package build --zip -v
```
- Uploaded the resulting zip
[verified-1.0.0.zip](https://github.com/elastic/kibana/files/10664094/verified-1.0.0.zip)
```
curl -XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true' http://localhost:5601/julia/api/fleet/epm/packages -u elastic:changeme --data-binary @verified-1.0.0.zip
```
- Navigate to `Integrations` page, verify that the `Verified` package is
displayed under `Browse` / `Installed` integrations, and the details are
visible when clicking on the package.

<img width="639" alt="image"
src="https://user-images.githubusercontent.com/90178898/217000305-90c28293-bdfa-42d5-b30b-50f7a63aad11.png">
<img width="757" alt="image"
src="https://user-images.githubusercontent.com/90178898/217000420-208d3b90-5341-4f1f-8ab8-554f78821bbf.png">
<img width="1147" alt="image"
src="https://user-images.githubusercontent.com/90178898/217000541-06324345-4204-43cc-8411-6c961ec37d17.png">


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
benakansara pushed a commit to benakansara/kibana that referenced this pull request Feb 7, 2023
…0332)

## Summary

Related to elastic#148599
Fixes elastic#81995

Changed `GET /epm/packages` API to list uploaded packages as well that
are not in registry.

Testing steps:
- Built a test package that is not in registry from kibana repo:
```
x-pack/test/fleet_api_integration/apis/fixtures/package_verification/packages/src/verified-1.0.0
elastic-package build --zip -v
```
- Uploaded the resulting zip
[verified-1.0.0.zip](https://github.com/elastic/kibana/files/10664094/verified-1.0.0.zip)
```
curl -XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true' http://localhost:5601/julia/api/fleet/epm/packages -u elastic:changeme --data-binary @verified-1.0.0.zip
```
- Navigate to `Integrations` page, verify that the `Verified` package is
displayed under `Browse` / `Installed` integrations, and the details are
visible when clicking on the package.

<img width="639" alt="image"
src="https://user-images.githubusercontent.com/90178898/217000305-90c28293-bdfa-42d5-b30b-50f7a63aad11.png">
<img width="757" alt="image"
src="https://user-images.githubusercontent.com/90178898/217000420-208d3b90-5341-4f1f-8ab8-554f78821bbf.png">
<img width="1147" alt="image"
src="https://user-images.githubusercontent.com/90178898/217000541-06324345-4204-43cc-8411-6c961ec37d17.png">


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Feb 8, 2023
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add the label auto-backport or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 150332 locally

@kibanamachine kibanamachine added backport:skip This commit does not require backporting and removed backport missing Added to PRs automatically when the are determined to be missing a backport. labels Feb 8, 2023
@juliaElastic juliaElastic removed the backport:skip This commit does not require backporting label Feb 8, 2023
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet] Use epm-packages saved object as main source of truth for installed packages
5 participants