-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] rollback input package install on failure #182665
[Fleet] rollback input package install on failure #182665
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
/ci |
/ci |
Pinging @elastic/fleet (Team:Fleet) |
Yes, it shouldn't, I'll take a look. Hmm, I can't reproduce it, do you see something like this in kibana logs?
|
@juliaElastic Yes, I did get that error:
Funnily enough, I just tried it again after uninstalling the package and this time it wasn't installed after getting the error. After wiping my ES and restarting ES and Kibana, I am able to reproduce it again. This time the above error does not appear in the logs. Perhaps it is something with the package cache?:
|
@jen-huang I could reproduce now, it happens when the package is not installed and the add integration also includes creation of a new agent policy.
I added a fix to remove the input package from the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested both cases locally and code LGTM 🚢
PS now it's easier to validate ES assets on the Assets tab :)
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
## Summary Closes elastic#181032 2 improvements on input package policy creation failure handling: - if the package was not installed initially, rolling back on failure - only saving es references with the input package installation if the templates are added successfully, to prevent issues with upgrade later if the references would contain invalid template names - this is needed if the input package was installed before attempting to add a package policy, in this case we don't want to completely uninstall the package on failure To verify: Custom Logs package uninstalled: - add Custom Logs integration with dataset name with a * in it e.g. `generic*` - the package policy creation is expected to fail - verify that the Custom Logs package is not installed Custom Logs package installed: - Install Custom Logs package without package policy or add integration with the default dataset name to succeed - try adding another policy with dataset `generic*` - the package policy creation is expected to fail - verify that the Custom Logs package doesn't have any `installed_es` references with the invalid `generic*` prefix `GET .kibana_ingest/_search?q=epm-packages.name:log` ### Checklist - [x] [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 --------- Co-authored-by: Jen Huang <its.jenetic@gmail.com> (cherry picked from commit 0833045)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…182983) # Backport This will backport the following commits from `main` to `8.14`: - [[Fleet] rollback input package install on failure (#182665)](#182665) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Julia Bardi","email":"90178898+juliaElastic@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-05-08T17:54:21Z","message":"[Fleet] rollback input package install on failure (#182665)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/181032\r\n\r\n2 improvements on input package policy creation failure handling:\r\n- if the package was not installed initially, rolling back on failure\r\n- only saving es references with the input package installation if the\r\ntemplates are added successfully, to prevent issues with upgrade later\r\nif the references would contain invalid template names\r\n- this is needed if the input package was installed before attempting to\r\nadd a package policy, in this case we don't want to completely uninstall\r\nthe package on failure\r\n\r\nTo verify:\r\nCustom Logs package uninstalled:\r\n- add Custom Logs integration with dataset name with a * in it e.g.\r\n`generic*`\r\n- the package policy creation is expected to fail\r\n- verify that the Custom Logs package is not installed \r\n\r\nCustom Logs package installed:\r\n- Install Custom Logs package without package policy or add integration\r\nwith the default dataset name to succeed\r\n- try adding another policy with dataset `generic*`\r\n- the package policy creation is expected to fail\r\n- verify that the Custom Logs package doesn't have any `installed_es`\r\nreferences with the invalid `generic*` prefix\r\n`GET .kibana_ingest/_search?q=epm-packages.name:log`\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Jen Huang <its.jenetic@gmail.com>","sha":"0833045a42cd0b0f788e3a743953f9e364705350","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Fleet","v8.14.0","v8.15.0"],"title":"[Fleet] rollback input package install on failure","number":182665,"url":"https://github.com/elastic/kibana/pull/182665","mergeCommit":{"message":"[Fleet] rollback input package install on failure (#182665)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/181032\r\n\r\n2 improvements on input package policy creation failure handling:\r\n- if the package was not installed initially, rolling back on failure\r\n- only saving es references with the input package installation if the\r\ntemplates are added successfully, to prevent issues with upgrade later\r\nif the references would contain invalid template names\r\n- this is needed if the input package was installed before attempting to\r\nadd a package policy, in this case we don't want to completely uninstall\r\nthe package on failure\r\n\r\nTo verify:\r\nCustom Logs package uninstalled:\r\n- add Custom Logs integration with dataset name with a * in it e.g.\r\n`generic*`\r\n- the package policy creation is expected to fail\r\n- verify that the Custom Logs package is not installed \r\n\r\nCustom Logs package installed:\r\n- Install Custom Logs package without package policy or add integration\r\nwith the default dataset name to succeed\r\n- try adding another policy with dataset `generic*`\r\n- the package policy creation is expected to fail\r\n- verify that the Custom Logs package doesn't have any `installed_es`\r\nreferences with the invalid `generic*` prefix\r\n`GET .kibana_ingest/_search?q=epm-packages.name:log`\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Jen Huang <its.jenetic@gmail.com>","sha":"0833045a42cd0b0f788e3a743953f9e364705350"}},"sourceBranch":"main","suggestedTargetBranches":["8.14"],"targetPullRequestStates":[{"branch":"8.14","label":"v8.14.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.15.0","branchLabelMappingKey":"^v8.15.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/182665","number":182665,"mergeCommit":{"message":"[Fleet] rollback input package install on failure (#182665)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/181032\r\n\r\n2 improvements on input package policy creation failure handling:\r\n- if the package was not installed initially, rolling back on failure\r\n- only saving es references with the input package installation if the\r\ntemplates are added successfully, to prevent issues with upgrade later\r\nif the references would contain invalid template names\r\n- this is needed if the input package was installed before attempting to\r\nadd a package policy, in this case we don't want to completely uninstall\r\nthe package on failure\r\n\r\nTo verify:\r\nCustom Logs package uninstalled:\r\n- add Custom Logs integration with dataset name with a * in it e.g.\r\n`generic*`\r\n- the package policy creation is expected to fail\r\n- verify that the Custom Logs package is not installed \r\n\r\nCustom Logs package installed:\r\n- Install Custom Logs package without package policy or add integration\r\nwith the default dataset name to succeed\r\n- try adding another policy with dataset `generic*`\r\n- the package policy creation is expected to fail\r\n- verify that the Custom Logs package doesn't have any `installed_es`\r\nreferences with the invalid `generic*` prefix\r\n`GET .kibana_ingest/_search?q=epm-packages.name:log`\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Jen Huang <its.jenetic@gmail.com>","sha":"0833045a42cd0b0f788e3a743953f9e364705350"}}]}] BACKPORT--> Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
Summary
Closes #181032
2 improvements on input package policy creation failure handling:
To verify:
Custom Logs package uninstalled:
generic*
Custom Logs package installed:
generic*
installed_es
references with the invalidgeneric*
prefixGET .kibana_ingest/_search?q=epm-packages.name:log
Checklist