|
63 | 63 | f'[]({NAVIGATOR_URL})' |
64 | 64 | ) |
65 | 65 | RULES_CONFIG = parse_rules_config() |
66 | | - |
| 66 | +# The base package version that we will start to include all versions of historical rules |
| 67 | +BASE_PKG_VERSION = Version(major=8,minor=17,patch=0) |
67 | 68 |
|
68 | 69 | def get_github_token() -> Optional[str]: |
69 | 70 | """Get the current user's GitHub token.""" |
@@ -124,7 +125,16 @@ def build_release(ctx: click.Context, config_file, update_version_lock: bool, ge |
124 | 125 | registry_data['conditions']['kibana.version'].strip("^")) |
125 | 126 | sde = SecurityDetectionEngine() |
126 | 127 | historical_rules = sde.load_integration_assets(previous_pkg_version) |
127 | | - limited_historical_rules = sde.keep_latest_versions(historical_rules) |
| 128 | + current_pkg_version = Version.parse(registry_data['version']) |
| 129 | + # pre-release versions are not included in the version comparison |
| 130 | + # Version 8.17.0-beta.1 is considered lower than 8.17.0 |
| 131 | + current_pkg_version_no_prerelease = Version(major=current_pkg_version.major,minor=current_pkg_version.minor,patch=current_pkg_version.patch) |
| 132 | + if current_pkg_version_no_prerelease>= BASE_PKG_VERSION: |
| 133 | + click.echo(f'[+] Adding all historical rule versions in our release package for version {current_pkg_version_no_prerelease}') |
| 134 | + limited_historical_rules = historical_rules |
| 135 | + else: |
| 136 | + click.echo(f'[+] Limit historical rule versions in our release package for version {current_pkg_version_no_prerelease}') |
| 137 | + limited_historical_rules = sde.keep_latest_versions(historical_rules) |
128 | 138 | package.add_historical_rules(limited_historical_rules, registry_data['version']) |
129 | 139 | click.echo(f'[+] Adding historical rules from {previous_pkg_version} package') |
130 | 140 |
|
|
0 commit comments