diff --git a/.changelog/5159.yml b/.changelog/5159.yml deleted file mode 100644 index b60c27b4cf6..00000000000 --- a/.changelog/5159.yml +++ /dev/null @@ -1,4 +0,0 @@ -changes: -- description: Adding support for handling private repositories. - type: feature -pr_number: 5159 diff --git a/.changelog/5166.yml b/.changelog/5166.yml deleted file mode 100644 index d4943fc88a6..00000000000 --- a/.changelog/5166.yml +++ /dev/null @@ -1,4 +0,0 @@ -changes: -- description: Fixed an issue where the ***format*** command attempted to format list data files when it should only format list metadata files. - type: fix -pr_number: 5166 diff --git a/.changelog/5169.yml b/.changelog/5169.yml deleted file mode 100644 index 464b575864c..00000000000 --- a/.changelog/5169.yml +++ /dev/null @@ -1,4 +0,0 @@ -changes: -- description: Ignore gr110 when validating all in the github action. - type: internal -pr_number: 5169 diff --git a/CHANGELOG.md b/CHANGELOG.md index 04542ae2090..6a8970dcc8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,15 @@ # Changelog +## 1.38.16 (2025-12-28) +### Feature +* Adding support for handling private repositories. [#5159](https://github.com/demisto/demisto-sdk/pull/5159) + +### Fix +* Fixed an issue where the ***format*** command attempted to format list data files when it should only format list metadata files. [#5166](https://github.com/demisto/demisto-sdk/pull/5166) + +### Internal +* Ignore gr110 when validating all in the github action. [#5169](https://github.com/demisto/demisto-sdk/pull/5169) + + ## 1.38.15 (2025-12-16) ### Feature * Added the `provider` field to the integration schema. [#5155](https://github.com/demisto/demisto-sdk/pull/5155) diff --git a/demisto_sdk/commands/content_graph/commands/update.py b/demisto_sdk/commands/content_graph/commands/update.py index f4440715901..177659803e4 100644 --- a/demisto_sdk/commands/content_graph/commands/update.py +++ b/demisto_sdk/commands/content_graph/commands/update.py @@ -30,11 +30,11 @@ def should_update_graph( content_graph_interface: ContentGraphInterface, use_git: bool, - git_util: GitUtil, + git_util: Optional[GitUtil], imported_path: Optional[Path] = None, packs_to_update: Optional[List[str]] = None, ): - if content_graph_interface.commit: + if content_graph_interface.commit and git_util: try: changed_pack_ids = git_util.get_all_changed_pack_ids( content_graph_interface.commit @@ -97,14 +97,25 @@ def update_content_graph( logger.info("A path to import the graph from was not provided, using git") use_git = True - git_util = GitUtil() - is_external_repo = is_external_repository() + try: + git_util = GitUtil() + is_external_repo = is_external_repository() + except Exception as e: + logger.debug( + f"Could not initialize GitUtil: {e}. Assuming external repo and skipping git operations." + ) + # If git is not available, we can't use git-based updates + # This can happen in CI/CD environments where the working directory is not a git repo + use_git = False + git_util = None # type: ignore[assignment] + is_external_repo = True if is_external_repo: packs_to_update = get_all_repo_pack_ids() packs_to_update = list(packs_to_update) if packs_to_update else [] builder = ContentGraphBuilder(content_graph_interface) - if not should_update_graph( + # If git_util is None, we can't check if we should update, so assume we should not + if git_util and not should_update_graph( content_graph_interface, use_git, git_util, imported_path, packs_to_update ): logger.info( @@ -145,7 +156,12 @@ def update_content_graph( content_graph_interface, marketplace, dependencies, output_path ) return - if use_git and (commit := content_graph_interface.commit) and not is_external_repo: + if ( + use_git + and git_util + and (commit := content_graph_interface.commit) + and not is_external_repo + ): try: git_util.get_all_changed_pack_ids(commit) except Exception as e: diff --git a/demisto_sdk/commands/validate/initializer.py b/demisto_sdk/commands/validate/initializer.py index c7a58eda924..6be0b24a757 100644 --- a/demisto_sdk/commands/validate/initializer.py +++ b/demisto_sdk/commands/validate/initializer.py @@ -743,7 +743,9 @@ def git_paths_to_basecontent_set( old_path = file_path if isinstance(file_path, tuple): file_path, old_path = file_path - obj = BaseContent.from_path(file_path, raise_on_exception=True) + obj = BaseContent.from_path( + file_path, git_sha=None, raise_on_exception=True + ) if obj: obj.git_sha = current_git_sha obj.git_status = git_status diff --git a/demisto_sdk/commands/validate/validators/base_validator.py b/demisto_sdk/commands/validate/validators/base_validator.py index 9b29d60293b..4c155fbe833 100644 --- a/demisto_sdk/commands/validate/validators/base_validator.py +++ b/demisto_sdk/commands/validate/validators/base_validator.py @@ -176,10 +176,13 @@ def graph(self) -> ContentGraphInterface: if not self.graph_interface: logger.info("Graph validations were selected, will init graph") BaseValidator.graph_interface = ContentGraphInterface() - update_content_graph( - BaseValidator.graph_interface, - use_git=True, - ) + # Only update the graph if it's not already alive/initialized + # This prevents re-running git operations that may fail in CI/CD environments + if not BaseValidator.graph_interface.is_alive(): + update_content_graph( + BaseValidator.graph_interface, + use_git=True, + ) return self.graph_interface def __dir__(self): diff --git a/pyproject.toml b/pyproject.toml index b4df8640257..e8ecc9d9b03 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ exclude = "tests/.*|demisto_sdk/commands/init/templates/.*" [tool.poetry] name = "demisto-sdk" -version = "1.38.15" +version = "1.38.16" description = "\"A Python library for the Demisto SDK\"" authors = ["Demisto"] license = "MIT"