Skip to content
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

ContentItemXSIAM default fromversion is now 8.0.0 #4243

Merged
merged 12 commits into from
May 15, 2024
Merged
4 changes: 0 additions & 4 deletions .changelog/4235.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .changelog/4243.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
changes:
- description: Change the minimum version of ContentItemXSIAM to 8.0.0
ilaner marked this conversation as resolved.
Show resolved Hide resolved
type: fix
pr_number: 4243
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,9 @@ def validate_unknown_content(
def validate_fromversion(
tx: Transaction, file_paths: List[str], for_supported_versions: bool
):
excluded_from_version = [ContentType.TRIGGER]
op = ">=" if for_supported_versions else "<"
query = f"""// Returning all the USES relationships with where the target's fromversion is higher than the source's
MATCH (content_item_from:{ContentType.BASE_CONTENT}&!{"&!".join(excluded_from_version)} {{deprecated: false, is_test: false}})-[r:{RelationshipType.USES}{{mandatorily:true}}]->(n)
MATCH (content_item_from{{deprecated: false, is_test: false}})-[r:{RelationshipType.USES}{{mandatorily:true}}]->(n)
WHERE {versioned('content_item_from.fromversion')} < {versioned('n.fromversion')}
AND {versioned('n.fromversion')} {op} {versioned(GENERAL_DEFAULT_FROMVERSION)}
AND n.fromversion <> "{DEFAULT_CONTENT_ITEM_FROM_VERSION}" // skips types with no "fromversion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@

import demisto_client
from packaging.version import Version
from pydantic import DirectoryPath
from pydantic import DirectoryPath, validator

from demisto_sdk.commands.common.constants import MarketplaceVersions
from demisto_sdk.commands.common.constants import (
DEFAULT_CONTENT_ITEM_FROM_VERSION,
MINIMUM_XSOAR_SAAS_VERSION,
MarketplaceVersions,
)
from demisto_sdk.commands.common.tools import (
write_dict,
)
Expand All @@ -20,6 +24,12 @@


class ContentItemXSIAM(ContentItem, ABC):
@validator("fromversion", always=True)
def validate_from_version(cls, v: str) -> str:
if not v or DEFAULT_CONTENT_ITEM_FROM_VERSION == v:
return MINIMUM_XSOAR_SAAS_VERSION
return v

def dump(
self,
dir: DirectoryPath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

from demisto_sdk.commands.common import tools
from demisto_sdk.commands.common.constants import (
DEFAULT_CONTENT_ITEM_FROM_VERSION,
DEFAULT_CONTENT_ITEM_TO_VERSION,
MINIMUM_XSOAR_SAAS_VERSION,
MarketplaceVersions,
)
from demisto_sdk.commands.common.legacy_git_tools import git_path
Expand Down Expand Up @@ -379,7 +379,7 @@ def test_correlation_rule_parser(self, pack: Pack):
expected_name="correlation_rule_name",
expected_path=colrrelation_rule_path,
expected_content_type=ContentType.CORRELATION_RULE,
expected_fromversion=DEFAULT_CONTENT_ITEM_FROM_VERSION,
expected_fromversion=MINIMUM_XSOAR_SAAS_VERSION,
expected_toversion=DEFAULT_CONTENT_ITEM_TO_VERSION,
)

Expand Down
2 changes: 0 additions & 2 deletions demisto_sdk/commands/upload/tests/uploader_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -897,10 +897,8 @@ def test_upload_without_skip_validate(self, mocker, path: Path, version: str):
"metadata.json",
"pack_metadata.json",
"XSIAMDashboards/",
"XSIAMDashboards/xsiamdashboard-MyDashboard.json",
"XSIAMDashboards/external-xsiamdashboard-MyDashboard.json",
"Triggers/",
"Triggers/trigger-MyTrigger.json",
Comment on lines -900 to -903
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are these removed?

Copy link
Contributor Author

@thefrieddan1 thefrieddan1 May 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting the default fromversion of these items to 8.0.0 uploads only the external version of the files.

"Triggers/external-trigger-MyTrigger.json",
},
),
Expand Down
Loading