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] Refactor package installation / upgrade / downgrade and error recovery / rollback #82007

Closed
skh opened this issue Oct 29, 2020 · 2 comments · Fixed by #150444
Closed
Assignees
Labels
Feature:EPM Fleet team's Elastic Package Manager (aka Integrations) project Feature:Fleet Fleet team's agent central management project Team:Fleet Team label for Observability Data Collection Fleet team technical debt Improvement of the software architecture and operational architecture

Comments

@skh
Copy link
Contributor

skh commented Oct 29, 2020

Currently, direct package upload only allows the fresh installation of packages. It should support the same functionality of reinstalling, upgrading and downgrading packages as installation from the registry does. This logic is currently implemented in both installPackageFromRegistry() (full functionality) and installPackageByUpload() (install only) and should be factored out to a separate function.
Related files:

  • server/services/epm/packages/install.ts

Error recovery and rollback is currently implemented in handleInstallPackageFailure(), which is called from installPackageFromRegistry() (and also directly from the installPackageFromRegistryHandler() and possibly other places (security/endpoint?)), and in turn directly calls and is therefore tightly coupled with installPackageFromRegistry(). This needs to be factored out so that all installation methods can use the same function for error recovery and rollback.
Related files:

  • server/services/epm/packages/install.ts
  • server/routes/epm/handlers.ts

Possible scenarios

Installed package: registry package

New package

  • registry, newer version: supported, triggers update

  • registry, same version: supported, triggers reinstall

  • registry, older version: requires --force, triggers downgrade

  • upload, newer version: ?

  • upload, same version: ?

  • upload, older version: ?

Installed package: uploaded package

New package

  • registry, newer version: ?

  • registry, same version: ?

  • registry, older version: ?

  • upload, newer version: supported, triggers update

  • upload, same version: supported, triggers reinstall

  • upload, older version: supported, triggers downgrade (package upload has implicit --force)

@skh skh added Feature:EPM Fleet team's Elastic Package Manager (aka Integrations) project Feature:Fleet Fleet team's agent central management project Team:Fleet Team label for Observability Data Collection Fleet team labels Oct 29, 2020
@skh skh self-assigned this Oct 29, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Feature:EPM)

@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Feature:Fleet)

@ph ph added the v7.11 label Oct 29, 2020
@timroes timroes added v7.11.0 and removed v7.11 labels Oct 30, 2020
@ph ph removed the v7.11.0 label Feb 15, 2021
@jen-huang jen-huang added the technical debt Improvement of the software architecture and operational architecture label Apr 27, 2021
@juliaElastic juliaElastic self-assigned this Feb 7, 2023
juliaElastic added a commit that referenced this issue Feb 8, 2023
…150444)

## Summary

Related to #148599

Closes #82007

Factored out common logic in `installPackageFromRegistry` and
`installPackageByUpload` to a new function. This improves the upload
flow as well to handle install failure.

We might want to introduce a `force` flag for the upload API to
reinstall a package, now the logic does not do anything if the installed
version package is uploaded again.
EDIT: found [here](#82007) that
upload should work with an implicit `force` flag, so will update that.

More manual and automated tests needed.


### Checklist

- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:EPM Fleet team's Elastic Package Manager (aka Integrations) project Feature:Fleet Fleet team's agent central management project Team:Fleet Team label for Observability Data Collection Fleet team technical debt Improvement of the software architecture and operational architecture
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants