Bump package versions (#1418)
* Bump package versions * Add 7.14 migration; use master schema map if one does not exist * add test to ensure an entry exists in the stack-schema-map for the current package version Co-authored-by: Ross Wolf <31489089+rw-access@users.noreply.github.com>
This commit is contained in:
@@ -3,15 +3,15 @@
|
||||
# 2.0; you may not use this file except in compliance with the Elastic License
|
||||
# 2.0.
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
import jsonschema
|
||||
|
||||
from . import definitions
|
||||
from .rta_schema import validate_rta_mapping
|
||||
from ..semver import Version
|
||||
from ..utils import cached, get_etc_path, load_etc_dump
|
||||
from . import definitions
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
__all__ = (
|
||||
@@ -139,7 +139,7 @@ def downgrade_threshold_to_7_11(version: Version, api_contents: dict) -> dict:
|
||||
|
||||
@migrate("7.12")
|
||||
def migrate_to_7_12(version: Version, api_contents: dict) -> dict:
|
||||
"""Default migration for 7.9."""
|
||||
"""Default migration for 7.12."""
|
||||
return strip_additional_properties(version, api_contents)
|
||||
|
||||
|
||||
@@ -160,6 +160,12 @@ def downgrade_ml_multijob_713(version: Version, api_contents: dict) -> dict:
|
||||
return strip_additional_properties(version, api_contents)
|
||||
|
||||
|
||||
@migrate("7.14")
|
||||
def migrate_to_7_14(version: Version, api_contents: dict) -> dict:
|
||||
"""Default migration for 7.14."""
|
||||
return strip_additional_properties(version, api_contents)
|
||||
|
||||
|
||||
def downgrade(api_contents: dict, target_version: str, current_version: Optional[str] = None) -> dict:
|
||||
"""Downgrade a rule to a target stack version."""
|
||||
from ..packaging import current_stack_version
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
---
|
||||
package:
|
||||
name: "7.14"
|
||||
name: "7.15"
|
||||
release: true
|
||||
# exclude rules which have any of the following index <-> field pairs
|
||||
# exclude_fields:
|
||||
@@ -26,7 +26,7 @@ package:
|
||||
registry_data:
|
||||
categories: ["security"]
|
||||
conditions:
|
||||
kibana.version: "^7.14.0"
|
||||
kibana.version: "^7.15.0"
|
||||
description: Prebuilt detection rules for Elastic Security
|
||||
format_version: 1.0.0
|
||||
icons:
|
||||
@@ -40,4 +40,4 @@ package:
|
||||
release: beta
|
||||
title: Prebuilt Security Detection Rules
|
||||
type: integration
|
||||
version: 0.14.0-dev.0
|
||||
version: 0.15.0-dev.0
|
||||
|
||||
@@ -10,3 +10,7 @@
|
||||
"7.14.0":
|
||||
beats: "7.14.0"
|
||||
ecs: "1.11.0"
|
||||
|
||||
"7.15.0":
|
||||
beats: "master" # TODO: update this once beats releases
|
||||
ecs: "1.11.0"
|
||||
|
||||
@@ -10,9 +10,11 @@ import uuid
|
||||
|
||||
import eql
|
||||
|
||||
from detection_rules import utils
|
||||
from detection_rules.packaging import load_current_package_version
|
||||
from detection_rules.rule import TOMLRuleContents
|
||||
from detection_rules.schemas import downgrade
|
||||
from detection_rules.semver import Version
|
||||
|
||||
|
||||
class TestSchemas(unittest.TestCase):
|
||||
@@ -194,3 +196,14 @@ class TestSchemas(unittest.TestCase):
|
||||
build_rule("""
|
||||
process where process.pid == "some string field"
|
||||
""")
|
||||
|
||||
|
||||
class TestVersions(unittest.TestCase):
|
||||
"""Test that schema versioning aligns."""
|
||||
|
||||
def test_stack_schema_map(self):
|
||||
"""Test to ensure that an entry exists in the stack-schema-map for the current package version."""
|
||||
package_version = Version(load_current_package_version())
|
||||
stack_map = utils.load_etc_dump('stack-schema-map.yaml')
|
||||
err_msg = f'There is no entry defined for the current package ({package_version}) in the stack-schema-map'
|
||||
self.assertIn(package_version, [Version(v)[:2] for v in stack_map], err_msg)
|
||||
|
||||
Reference in New Issue
Block a user