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>

Removed changes from:
- etc/packages.yml

(selectively cherry picked from commit 2d517432e3)
This commit is contained in:
Justin Ibarra
2021-08-18 21:25:53 -08:00
committed by github-actions[bot]
parent c1b774cdb6
commit 60caedc026
3 changed files with 26 additions and 3 deletions
+9 -3
View File
@@ -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
+4
View File
@@ -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"
+13
View File
@@ -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)