-
Notifications
You must be signed in to change notification settings - Fork 529
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
[Meta] Update Prebuilt Detection Rules Release Process #3374
Comments
Review release-fleet workflow for updates and bugsThe release fleet workflow needs to be reviewed. There were changes to how we push package updates to the Integrations repository that may need to be addressed in this workflow. We may also be able to simplify this process by automatically obtaining the last locked version commit hash for each branch, rather than relying on the workflow input. An
Target branch of Integrations repository
As a result, the logic was adjusted a bit to only add @dev_group.command("bump-pkg-versions")
@click.option("--major-release", is_flag=True, help="bump the major version")
@click.option("--minor-release", is_flag=True, help="bump the minor version")
@click.option("--patch-release", is_flag=True, help="bump the patch version")
@click.option("--new-package", type=click.Choice(['true', 'false']), help="indicates new package")
@click.option("--maturity", type=click.Choice(['beta', 'ga'], case_sensitive=False),
required=True, help="beta or production versions")
def bump_versions(major_release: bool, minor_release: bool, patch_release: bool, new_package: str, maturity: str):
"""Bump the versions"""
pkg_data = load_etc_dump('packages.yml')['package']
kibana_ver = Version.parse(pkg_data['name'], optional_minor_and_patch=True)
pkg_ver = Version.parse(pkg_data["registry_data"]["version"])
pkg_kibana_ver = Version.parse(pkg_data["registry_data"]["conditions"]["kibana.version"].lstrip("^"))
if major_release:
major_bump = kibana_ver.bump_major()
pkg_data["name"] = f"{major_bump.major}.{major_bump.minor}"
pkg_data["registry_data"]["conditions"]["kibana.version"] = f"^{pkg_kibana_ver.bump_major()}"
pkg_data["registry_data"]["version"] = str(pkg_ver.bump_major().bump_prerelease("beta"))
if minor_release:
minor_bump = kibana_ver.bump_minor()
pkg_data["name"] = f"{minor_bump.major}.{minor_bump.minor}"
pkg_data["registry_data"]["conditions"]["kibana.version"] = f"^{pkg_kibana_ver.bump_minor()}"
pkg_data["registry_data"]["version"] = str(pkg_ver.bump_minor().bump_prerelease("beta"))
if patch_release:
latest_patch_release_ver = find_latest_integration_version("security_detection_engine",
maturity, pkg_kibana_ver)
# if an existing minor or major does not have a package, bump from the last
# example is 8.10.0-beta.1 is last, but on 9.0.0 major
# example is 8.10.0-beta.1 is last, but on 8.11.0 minor
if latest_patch_release_ver.minor != pkg_kibana_ver.minor:
latest_patch_release_ver = latest_patch_release_ver.bump_minor()
if latest_patch_release_ver.major != pkg_kibana_ver.major:
latest_patch_release_ver = latest_patch_release_ver.bump_major()
if maturity == "ga":
pkg_data["registry_data"]["version"] = str(latest_patch_release_ver.bump_patch())
else:
# passing in true or false from GH actions; not using eval() for security purposes
if new_package == "true":
latest_patch_release_ver = latest_patch_release_ver.bump_patch()
pkg_data["registry_data"]["version"] = str(latest_patch_release_ver.bump_prerelease("beta"))
if 'release' in pkg_data['registry_data']:
pkg_data['registry_data']['release'] = maturity
click.echo(f"Kibana version: {pkg_data['name']}")
click.echo(f"Package Kibana version: {pkg_data['registry_data']['conditions']['kibana.version']}")
click.echo(f"Package version: {pkg_data['registry_data']['version']}")
save_etc_dump({"package": pkg_data}, "packages.yml") Adjust fleet package building to add historical rules by default Since we are past this window, there is not longer a need to have this flag set to "no" by default and rather it can be set to "yes". Optionally, we could remove it entirely and have the default always add historical rules. Note that I tested the build on 8.3 branch with this flag set to "yes" and the build package was fine. Update After these changes were applied, a workflow run was done from the working branch for these changes which was successful and pushed a PR to integrations as expected. Reference: elastic/integrations#8987 |
Adjust registry_data:
categories:
- security
conditions:
kibana.version: ^8.13.0
elastic:
subscription: basic
description: Prebuilt detection rules for Elastic Security
format_version: 3.0.0
icons:
- size: 16x16
src: /img/security-logo-color-64px.svg
type: image/svg+xml
source:
license: Elastic-2.0
name: security_detection_engine
owner:
github: elastic/protections
type: elastic
title: Prebuilt Security Detection Rules
type: integration
version: 8.13.0-beta.0 Additionally, an important consideration is when we add historical rules, we used to rely on if add_historical:
previous_pkg_version = find_latest_integration_version("security_detection_engine", "ga",
registry_data['conditions']['kibana.version'].strip("^"))
sde = SecurityDetectionEngine()
historical_rules = sde.load_integration_assets(previous_pkg_version)
historical_rules = sde.transform_legacy_assets(historical_rules)
docs = IntegrationSecurityDocsMDX(config['registry_data']['version'], Path(f'releases/{config["name"]}-docs'),
True, historical_rules, package, note=update_message)
docs.generate()
click.echo(f'[+] Adding historical rules from {previous_pkg_version} package')
package.add_historical_rules(historical_rules, config['registry_data']['version']) To resolve this we need to checkout |
Update 01-26-2024We have made progress with updating the Detection Rules release process, ultimately addressing bugs and exceptions that were introduced from changes upstream. Please review to the tasklist of this issue to view which has been addressed so far. Moving forward, we should have the bugs and exceptions addressed in the linked pull request. We will need to still review #2807, make updates and merge accordingly, once done, this issue can be marked as complete. |
Update 02-06-2024This issue has been re-opened. It was closed due to the only linked pull request being merged, however, changes still need to occur.
The detection rules release has been started with @shashank-elastic. |
Parent Epic (If Applicable)
Meta Summary
Importance: Reduce time-to-release by fixing tools and processes for the release workflow that do not currently work. A list of these has been included below, along with a summary of what needs to be resolved.
release-fleet.yml
) - Needs to be reviewed for reliability. Does not handle exceptions for branches such as 8.10. Needs arguments to target backport branches in integrations.release-docs.yml
) - Needs to be reviewed for reliability. Code logic should take into account ASCII doc URL formatting or broken links, deprecated rule handling and new minor release pages with main as base.Estimated Time to Complete
~2 weeks
Potential Blockers
No potential blockers for this meta.
Tasklist
Another tasklist will be created as each bug is identified and analyzed.
Meta Tasks
build-release
CLI and fix links when generating security docs #3434The text was updated successfully, but these errors were encountered: