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

Expose source.license through the API #854

Merged
merged 3 commits into from
Jul 28, 2022

Conversation

jsoriano
Copy link
Member

Add label indicating the distribution license of the package, as defined in elastic/package-spec#355.

Required by Fleet for elastic/package-spec#298 (elastic/package-spec#298 (comment)).

@jsoriano jsoriano requested review from jen-huang and a team July 27, 2022 09:53
@jsoriano jsoriano self-assigned this Jul 27, 2022
@elasticmachine
Copy link

elasticmachine commented Jul 27, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-07-28T09:49:57.080+0000

  • Duration: 6 min 47 sec

Test stats 🧪

Test Results
Failed 0
Passed 213
Skipped 0
Total 213

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@@ -121,6 +122,11 @@ type PolicyTemplate struct {
TemplatePath string `config:"template_path,omitempty" json:"template_path,omitempty" yaml:"template_path,omitempty"`
}

// Source contains metadata about the source of the package and its distribution.
type Source struct {
License string `config:"license" json:"license"`
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: omit empty and yaml?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added

@@ -82,6 +82,7 @@ type BasePackage struct {
Title *string `config:"title,omitempty" json:"title,omitempty" yaml:"title,omitempty"`
Version string `config:"version" json:"version"`
Release string `config:"release,omitempty" json:"release,omitempty"`
Source *Source `config:"source,omitempty" json:"source,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

Do you want a yaml:"source,omitempty" here too? This struct inconsistently uses yaml tags.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, good point, we should take a look to these differences. @mtojek do you know why there are fields with different sets of annotations?

@jen-huang
Copy link
Contributor

Thanks @jsoriano! I'll test the changes next week when I am back from PTO.

@jsoriano
Copy link
Member Author

Merging this so this is available soon.

@jen-huang let me know if this is not enough after your tests, but I think we cannot do something very different to expose this value 🙂

Copy link
Contributor

@mrodm mrodm left a comment

Choose a reason for hiding this comment

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

LGTM

@jsoriano jsoriano merged commit 79e456c into elastic:main Jul 28, 2022
@jsoriano jsoriano deleted the expose-source-license branch July 28, 2022 16:53
@jen-huang
Copy link
Contributor

@jen-huang let me know if this is not enough after your tests, but I think we cannot do something very different to expose this value 🙂

I tested this for elastic/kibana#137799 and things work fine 👍

Could I trouble you to also include a LICENSE.txt in one of these test packages? I need to test from the UI that we display a modal containing the license text.

@jsoriano
Copy link
Member Author

jsoriano commented Aug 2, 2022

Could I trouble you to also include a LICENSE.txt in one of these test packages? I need to test from the UI that we display a modal containing the license text.

Do you need a real package with a LICENSE.txt? Or it is enough with a test package? For test package you can use the good package in the package-spec test suite.
For real packages, we have to open the discussion about how to include the license text file in built packages, in the current integrations monorepo the license is in the root of the repository, and adding headers in files may be needed to properly apply the license.

@jen-huang
Copy link
Contributor

No, I don't need a real package, just something to test my local EPR with. I'll try loading up the good package. Thanks!

@jsoriano
Copy link
Member Author

jsoriano commented Aug 3, 2022

Packages will eventually contain the license of the repository after this change elastic/elastic-package#920

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants