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

Initial support for content packages #2049

Merged
merged 4 commits into from
Sep 10, 2024

Conversation

jsoriano
Copy link
Member

@jsoriano jsoriano commented Aug 28, 2024

  • Add archetype for elastic-package create package.
  • Add test package, tests pass, but they do nothing.
  • Package installation seems to work, we will need to review related code in Kibana.

Part of #2048
Part of elastic/package-spec#351

@jsoriano jsoriano requested a review from a team August 28, 2024 11:09
@jsoriano jsoriano self-assigned this Aug 28, 2024
@jsoriano jsoriano marked this pull request as draft August 28, 2024 11:09
@jsoriano jsoriano marked this pull request as ready for review September 9, 2024 16:07
internal/packages/packages.go Outdated Show resolved Hide resolved
Comment on lines +72 to +73
specVersion = *minSpecVersion
excludeChecks = append(excludeChecks, "PSR00002")
Copy link
Contributor

Choose a reason for hiding this comment

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

Currently, elastic-package create package it would create a content package with format_version: 3.2.2 (latest spec version published). Should it be set somehow here for content packages at least 3.4.0 ?

Just created a package, and when running elastic-package build, it shows these errors:

Error: building package failed: invalid content found in built zip package: found 6 validation errors:
   1. package with non-stable semantic version and active beta features (enabled in [/home/user/Coding/work/elastic-package/build/packages/new_package-0.0.1.zip]) can't be released as stable version. (PSR00002)
   2. item [LICENSE.txt] is not allowed in folder [/home/user/Coding/work/elastic-package/build/packages/new_package-0.0.1.zip]
   3. item [changelog.yml] is not allowed in folder [/home/user/Coding/work/elastic-package/build/packages/new_package-0.0.1.zip]
   4. item [docs] is not allowed in folder [/home/user/Coding/work/elastic-package/build/packages/new_package-0.0.1.zip]
   5. item [img] is not allowed in folder [/home/user/Coding/work/elastic-package/build/packages/new_package-0.0.1.zip]
   6. item [manifest.yml] is not allowed in folder [/home/user/Coding/work/elastic-package/build/packages/new_package-0.0.1.zip]

When updating the format_version to 3.4.0, it still reports this error:

Error: building package failed: invalid content found in built zip package: found 1 validation error:
   1. package with non-stable semantic version and active beta features (enabled in [/home/mariorodriguez/Coding/work/elastic-package/build/packages/new_package-0.0.1.zip]) can't be released as stable version. (PSR00002)

Copy link
Member Author

Choose a reason for hiding this comment

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

These are handled in the test case, I didn't add the exceptions to the real command to don't make it too easy to use content packages yet, and to avoid us having to remember to remove these exceptions when/if the package is released as GA.

Would you prefer that we add the exceptions in the command?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah ok! Better to force to add the exceptions manually. No need to change anything then.

@@ -92,6 +94,14 @@ func createPackageInDir(packageDescriptor PackageDescriptor, cwd string) error {

}

if len(packageDescriptor.ExcludeChecks) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

There were no exclude checks when creating a content package. These are the files created:

 $ elastic-package create package 
Create a new package
? Package type: content
? Package name: new_package
? Version: 0.0.1
? License: Elastic-2.0
? Package title: New Package
? Description: This is a new package.
? Categories: custom
? Kibana version constraint: ^8.15.1
? Required Elastic subscription: basic
? Github owner: elastic/integrations
? Owner type: elastic
New package has been created: new_package
Done

 $ cd new_package

 $ ls -l 
total 20
-rw-r--r-- 1 user user  226 sep  9 18:22 changelog.yml
drwxr-xr-x 2 user user 4096 sep  9 18:22 docs
drwxr-xr-x 2 user user 4096 sep  9 18:22 img
-rw-rw-r-- 1 user user 3860 sep  9 18:22 LICENSE.txt
-rw-r--r-- 1 user user  560 sep  9 18:26 manifest.yml

Copy link
Member Author

Choose a reason for hiding this comment

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

That's correct. I added this mainly for testing by now.

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

cc @jsoriano

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.

👍

@jsoriano jsoriano merged commit 6d62d67 into elastic:main Sep 10, 2024
3 checks passed
@jsoriano jsoriano deleted the content-packages-initial-support branch September 10, 2024 08:01
@jsoriano jsoriano restored the content-packages-initial-support branch September 10, 2024 09:11
@jsoriano jsoriano deleted the content-packages-initial-support branch September 10, 2024 09:11
@jsoriano jsoriano mentioned this pull request Sep 10, 2024
13 tasks
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.

3 participants