Skip to content

Initial support for content packages#2049

Merged
jsoriano merged 4 commits intoelastic:mainfrom
jsoriano:content-packages-initial-support
Sep 10, 2024
Merged

Initial support for content packages#2049
jsoriano merged 4 commits intoelastic:mainfrom
jsoriano:content-packages-initial-support

Conversation

@jsoriano
Copy link
Copy Markdown
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
Comment on lines +72 to +73
specVersion = *minSpecVersion
excludeChecks = append(excludeChecks, "PSR00002")
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.


}

if len(packageDescriptor.ExcludeChecks) > 0 {
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Collaborator

💚 Build Succeeded

cc @jsoriano

Copy link
Copy Markdown
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
@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