-
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
[Security Solution] Adds support for testing of prerelease detection rules #148426
[Security Solution] Adds support for testing of prerelease detection rules #148426
Conversation
…ase-detection-rules
…ase-detection-rules
…ase-detection-rules
…prebuiltRulesPackageVersion to browser
…ase-detection-rules
…ase-detection-rules
…ase-detection-rules
…ase-detection-rules
…ase-detection-rules
…ase-detection-rules
…ase-detection-rules
…ase-detection-rules
Pinging @elastic/security-detections-response (Team:Detections and Resp) |
Pinging @elastic/security-solution (Team: SecuritySolution) |
…ase-detection-rules
@xcrzx you didn't miss anything! Looks like this requires additional/explicit config for the cypress CI runner. I just tested by adding the config to the Note though, since we're now sending That said, I can check with @MadameSheema, and maybe we can put this setting in its own config like they're doing with As for using this within the FTR suites, we'd need to do the same and include the config in one of our group configs like But since this config is used client-side only, it might just be best for me to include a util function for installing a specific fleet package manually before a test, and then we can use those explicitly where needed. I went down the path of setting this as above, and including a mocked out fleet bundled with two different package versions that would actually use the kibana.yml setting (similar to the fleet_api_integration tests), but was running into issues and seemed like too much overhead. Let me know if you agree a util function will suffice here (added in c467762), otherwise maybe we can pair when it comes time to write some additional FTR's and see if we can't get it working with a mocked out fleet instance. |
@elasticmachine merge upstream |
This should be fine for now, as we don't have integrational tests that require actual Fleet packages. I'll be adding some in #148176, so will see what would be the best way to install a required package version. Likely, calling 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.
LGTM 👍
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.
security-engineering-productivity LGTM!!
While TRaDE is currently working on updating our release process and starting with prerelease packages, we are using Reference: https://epr.elastic.co/package/security_detection_engine/8.3.4-beta.1/ |
@elasticmachine merge upstream |
cec368a
to
363821b
Compare
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.
Reviewed the code changes and tested locally with the 8.3.4-beta.1
version mentioned by @terrancedejesus:
- Run the app locally with
xpack.securitySolution.prebuiltRulesPackageVersion: 8.3.4-beta.1
specified inconfig/kibana.dev.yml
- Run Cypress tests locally with
--xpack.securitySolution.prebuiltRulesPackageVersion=8.3.4-beta.1
specified inx-pack/test/security_solution_cypress/config.ts
Everything worked as expected! 🎉 And I did really appreciate all the comments added to the code, thank you! I left a bunch of nits, but nothing really important.
@spong What are our next steps to make sure everyone understands how that works and could be used for testing prerelease versions? I'm thinking about the following:
- Let's update our dev docs with the corresponding info https://docs.elastic.dev/security-solution/analyst-experience/detections/rules/prebuilt-rules
- Test it with a bunch of (fake?) prerelease versions for 8.7 and help @terrancedejesus open a bunch of PRs and see if it fits the release workflow of the TRADE team
src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/common/hooks/use_upgrade_secuirty_packages.test.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/common/hooks/use_upgrade_security_packages.ts
Outdated
Show resolved
Hide resolved
...plugins, | ||
kibanaBranch: this.kibanaBranch, | ||
kibanaVersion: this.kibanaVersion, | ||
prebuiltRulesPackageVersion: this.prebuiltRulesPackageVersion, |
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.
Nit: It looks a bit disjoined from the rest of the config passed to the FE. I think that we could probably combine ExperimentalFeaturesService
with the rest of the config and simply pass the whole parsed config to KibanaServices.init
. No more manual passing of new config settings would be needed when we add some new settings again. Just a thought for future modifications, not suggesting refactoring it within this PR!
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.
++, this would be a nice QoL improvement here for managing these configs. Would be curious to revisit how other plugins are doing it as well these days (between client/server). cc @elastic/security-solution-platform
That sounds good to me @banderror! Additionally I was going to update the source issues with instructions, and also create a sample Kibana PR (with the new config) for the TRADE team to use as example (as you mentioned). And as discussed yesterday, will look into if we can just have a templated Buildkite job that we can trigger with the config instead of having to open/close a Kibana PR each time. edit: |
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: cc @spong |
Nope, we should be all good here! 🙂 The explicit |
Summary
Resolves #147466
Resolves #112910
useUpgradeSecurityPackages
hook to install theprerelease
version of theendpoint
andsecurity_detection_engine
packages if the current branch ismain
or build is-SNAPSHOT
(to ensure PR's are testing against the latest to-be-released packages)kibana.yml
configurationxpack.securitySolution.prebuiltRulesPackageVersion
for specifying the version of thesecurity_detection_engine
package to install within the client-side logic of theuseUpgradeSecurityPackages
hookxpack.securitySolution.prebuiltRulesPackageVersion
configuration from thekbnServerArgs
and for installing a specific detection rules package version c467762.useUpgradeSecurityPackages
tests from #112910Note: I added jest tests for the
useUpgradeSecurityPackages
changes, however didn't find a reasonable way to test theprebuiltRulesPackageVersion
configuration addition via FTR's, so ended up testing that manually by running a localpackage-registry
and serving up two different versions of thesecurity_detection_engine
package (8.3.1
/8.4.1
) and specifyingin my
kibana.dev.yml
to try and install the previous version. This initially failed as fleet would say the package isout-of-date
Since there was a higher version with the same
kibana.version
requirement:kibana.version: ^8.4.0
. Modifying this for the higher version to^8.9.0
then allowed for the installation of the8.3.1
as specified in theprebuiltRulesPackageVersion
setting:As mentioned by @xcrzx, I ended up adding
force:true
to the individual install request to get around this limitation and to have a better testing experience within Cypress.Note II: When using the
prebuiltRulesPackageVersion
setting, since this is used for updates initiated from the client and not on kibana start like thefleet_package.json
(added in #143839), you will have to uninstall the package that was installed on start-up for this to be successful.Note III: When wanting to run the Cypress tests against a specific package version, be sure to update the cypress FTR configuration cf3a83f.
Checklist
Delete any items that are not applicable to this PR.