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] Support new subscription and license fields #137799

Merged
merged 14 commits into from
Sep 20, 2022

Conversation

jen-huang
Copy link
Contributor

@jen-huang jen-huang commented Aug 1, 2022

Summary

Part of elastic/package-spec#298. This PR adds support for the new source.license and conditions.elastic.subscription fields in packages:

  • source.license is a new field containing the name of the license of the package, i.e. Apache 2.0
    • If a package contains a license, an additional LICENSE.txt file lives at the root of the package. This PR adjusts the package info endpoint to return the path to the license file. The package details UI surfaces the license contents in a modal
  • conditions.elastic.subscription is a field reflecting the necessary Elastic subscription needed to install the package, it replaced the now deprecated top-level license field
    • This PR falls back to license when the new field is not available
    • This PR does not enforce the subscription requirement when installing a package (same behavior as today)

Testing

  1. Clone package-spec repo, use elastic-package to build good package
  2. In local package registry, pull from upstream if you haven't in a while, and copy the build good package to {package registry root}/testdata/package
  3. Run Kibana connected to local package registry, check details of good package and verify that subscription and license information exists. Check details of any other package and verify that subscription details are as expected.

Screenshots

image

image

@jen-huang jen-huang marked this pull request as ready for review September 20, 2022 00:26
@jen-huang jen-huang requested a review from a team as a code owner September 20, 2022 00:26
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

type: string
enum:
- Apache-2.0
- Elastic-2.0
Copy link
Contributor

Choose a reason for hiding this comment

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

are these the only possible values?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -392,3 +392,15 @@ export function getNoticePath(paths: string[]): string | undefined {

return undefined;
}

export function getLicensePath(paths: string[]): string | undefined {
Copy link
Contributor

Choose a reason for hiding this comment

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

it would be nice to unit test this function

// Simulate a long text while loading
<>
<p>
<EuiLoadingContent lines={5} />
Copy link
Contributor

Choose a reason for hiding this comment

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

nice!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i copied this from the notice_modal that we already had in the same directory... can't take too much credit :D

<EuiModal maxWidth={true} onClose={onClose}>
<EuiModalHeader>
<EuiModalHeaderTitle>
<h1>LICENSE.txt</h1>
Copy link
Contributor

@juliaElastic juliaElastic Sep 20, 2022

Choose a reason for hiding this comment

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

Should we display the file name from license field, I think it is not always LICENSE.txt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the file is always LICENSE.txt but yes we should display the name of the license instead (like Apache 2.0)

Copy link
Contributor

@juliaElastic juliaElastic left a comment

Choose a reason for hiding this comment

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

LGTM, added a few comments

@jen-huang jen-huang enabled auto-merge (squash) September 20, 2022 17:42
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
fleet 757 758 +1

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
fleet 882 886 +4

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
fleet 910.7KB 912.7KB +2.0KB
Unknown metric groups

API count

id before after diff
fleet 982 986 +4

History

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

cc @jen-huang

@jen-huang jen-huang merged commit d31b499 into elastic:main Sep 20, 2022
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Sep 20, 2022
@jen-huang jen-huang deleted the feature/pkg-subscription branch September 20, 2022 22:51
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:enhancement Team:Fleet Team label for Observability Data Collection Fleet team v8.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants