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 migrating from integration type package to input type package #141472

Merged
merged 9 commits into from
Sep 23, 2022

Conversation

hop-dev
Copy link
Contributor

@hop-dev hop-dev commented Sep 22, 2022

Summary

Closes #137751

Minor fixes and api tests to support migrating a package from type "integration" to type "input".

How to test:

docker run -p 8080:8080 -v <path_to_test_folder>/packages:/packages/test-packages -v <path_to_test_folder>/package_registry_config.yml:/package-registry/config.yml docker.elastic.co/package-registry/package-registry:main
  • add this to your local kibana config:
xpack.fleet.registryUrl: http://localhost:8080
  • This makes the custom_logs package available, with version 0.9.0 which is an integration package, and 1.0.0 which is an input type package and adds a new mandatory param "tags"
  • install and create a package policy for 0.9.0
  • upgrade to 1.0.0
  • verify variables are correctly populated

Checklist

Delete any items that are not applicable to this PR.

@@ -106,4 +106,4 @@ const addDatasetVarIfNotPresent = (vars?: RegistryVarsEntry[]): RegistryVarsEntr
const createDefaultDatasetName = (
packageInfo: PackageInfo,
policyTemplate: RegistryPolicyInputOnlyTemplate
): string => packageInfo.name + '.' + policyTemplate.type;
): string => packageInfo.name + '.' + policyTemplate.name;
Copy link
Contributor Author

@hop-dev hop-dev Sep 22, 2022

Choose a reason for hiding this comment

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

During testing I found name to be a lot more descriptive here than type, and matches how integration packages tend to work

if (cache) setPackageInfo({ name, version, packageInfo });
// only cache registry pkg info for integration pkgs because
// input type packages must get their pkg info from the archive
if (packageInfo.type === 'integration') setPackageInfo({ name, version, packageInfo });
Copy link
Contributor Author

Choose a reason for hiding this comment

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

While investigating a bug where the cache parameter wasn't passed, I decided it was more explicit to have this function know that we never cache registry info for input packages (because we have to get the info from the archive)

@hop-dev hop-dev self-assigned this Sep 22, 2022
@hop-dev hop-dev added release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) labels Sep 22, 2022
@hop-dev hop-dev changed the title 137751 input pkg migration [Fleet] Support migrating from integration type package to input type package Sep 22, 2022
@hop-dev hop-dev marked this pull request as ready for review September 22, 2022 16:35
@hop-dev hop-dev requested a review from a team as a code owner September 22, 2022 16:35
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

Copy link
Member

@kpollich kpollich left a comment

Choose a reason for hiding this comment

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

Changes make sense to me and I greatly appreciate the added API tests here 🚀

@hop-dev hop-dev force-pushed the 137751-input-pkg-migration branch from 0d39c5f to 4292597 Compare September 23, 2022 07:41
@hop-dev hop-dev enabled auto-merge (squash) September 23, 2022 07:53
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

  • 💔 Build #74942 failed 0d39c5f8715eb35401abd54b9c1d4869452a9e4d

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

cc @hop-dev

@hop-dev hop-dev merged commit a61506b into elastic:main Sep 23, 2022
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Sep 23, 2022
… package (elastic#141472)

* it works

* neaten

* test failing

* fix test pkgs

* fix input to policy template matching

* move to zip packages

* never cache registry info for input packages

* remove .only

* fix dataset name in unit test

(cherry picked from commit a61506b)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.5

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

@hop-dev hop-dev deleted the 137751-input-pkg-migration branch September 23, 2022 08:48
kibanamachine added a commit that referenced this pull request Sep 23, 2022
… package (#141472) (#141578)

* it works

* neaten

* test failing

* fix test pkgs

* fix input to policy template matching

* move to zip packages

* never cache registry info for input packages

* remove .only

* fix dataset name in unit test

(cherry picked from commit a61506b)

Co-authored-by: Mark Hopkin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.5.0 v8.6.0
Projects
None yet
5 participants