Skip to content

Commit 707e105

Browse files
authored
added functionallity to download index by marketplace (demisto#29834)
* added functionallity to download index by marketplace * added some logs for validation * commit * removed logs
1 parent 5831847 commit 707e105

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Tests/Marketplace/marketplace_services.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
PackTags, PackIgnored, Changelog, BASE_PACK_DEPENDENCY_DICT, SIEM_RULES_OBJECTS, PackStatus, PACK_FOLDERS_TO_ID_SET_KEYS, \
3131
CONTENT_ROOT_PATH, XSOAR_MP, XSIAM_MP, XPANSE_MP, TAGS_BY_MP, CONTENT_ITEM_NAME_MAPPING, \
3232
ITEMS_NAMES_TO_DISPLAY_MAPPING, RN_HEADER_TO_ID_SET_KEYS
33+
from demisto_sdk.commands.common.constants import MarketplaceVersions, MarketplaceVersionToMarketplaceName
3334
from Utils.release_notes_generator import aggregate_release_notes_for_marketplace, merge_version_blocks, construct_entities_block
3435
from Tests.scripts.utils import logging_wrapper as logging
3536

@@ -4279,7 +4280,7 @@ def underscore_file_name_to_dotted_version(file_name: str) -> str:
42794280
return os.path.splitext(file_name)[0].replace('_', '.')
42804281

42814282

4282-
def get_last_commit_from_index(service_account):
4283+
def get_last_commit_from_index(service_account, marketplace=MarketplaceVersions.XSOAR):
42834284
""" Downloading index.json from GCP and extract last upload commit.
42844285
42854286
Args:
@@ -4288,8 +4289,9 @@ def get_last_commit_from_index(service_account):
42884289
Returns: last upload commit.
42894290
42904291
"""
4292+
production_bucket_name = MarketplaceVersionToMarketplaceName.get(marketplace)
42914293
storage_client = init_storage_client(service_account)
4292-
storage_bucket = storage_client.bucket(GCPConfig.PRODUCTION_BUCKET)
4294+
storage_bucket = storage_client.bucket(production_bucket_name)
42934295
index_storage_path = os.path.join('content/packs/', f"{GCPConfig.INDEX_NAME}.json")
42944296
index_blob = storage_bucket.blob(index_storage_path)
42954297
index_string = index_blob.download_as_string()

Tests/scripts/collect_tests/collect_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ def _get_git_diff(self) -> FilesToCollect:
10741074

10751075
if os.getenv('IFRA_ENV_TYPE') == 'Bucket-Upload':
10761076
logger.info('bucket upload: getting last commit from index')
1077-
previous_commit = get_last_commit_from_index(self.service_account)
1077+
previous_commit = get_last_commit_from_index(self.service_account, self.marketplace)
10781078
if self.branch_name == 'master':
10791079
current_commit = 'origin/master'
10801080

0 commit comments

Comments
 (0)