[FR] Update build-release to support bbr release (#2987)

* Fixes bug in unit tests

* fix rule paths

* removed unused import
This commit is contained in:
eric-forte-elastic
2023-07-31 15:20:18 -04:00
committed by GitHub
parent b8bb2da932
commit ea26ea77d7
+5 -3
View File
@@ -14,10 +14,10 @@ from marshmallow import pre_load
import json
from . import utils
from .attack import CURRENT_ATTACK_VERSION
from .mixins import MarshmallowDataclassMixin
from .rule import TOMLRule
from .rule_loader import DEFAULT_RULES_DIR, DEFAULT_BBR_DIR
from .schemas import definitions
@@ -163,8 +163,10 @@ class NavigatorBuilder:
def rule_links_dict(self, rule: TOMLRule) -> dict:
base_url = 'https://github.com/elastic/detection-rules/blob/main/rules/'
local_rules_path = utils.get_path('rules')
base_path = rule.path.relative_to(local_rules_path)
try:
base_path = str(rule.path.resolve().relative_to(DEFAULT_RULES_DIR))
except ValueError:
base_path = str(rule.path.resolve().relative_to(DEFAULT_BBR_DIR))
url = f'{base_url}{base_path}'
return self.links_dict(rule.name, url)