Skip to content

Commit

Permalink
Test PR creation
Browse files Browse the repository at this point in the history
  • Loading branch information
goruha committed Dec 6, 2024
1 parent 24bb445 commit 893c450
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/component_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def __update_component(self, infra_terraform_dir, component_file: str) -> Compon
# - vendoring_enabled = false
# - component vendored => skip component
# - component not vendored => do not vendor
needs_update, files_to_update, files_to_remove = self.__does_component_needs_to_be_updated(original_vendored_component, updated_vendored_component)
needs_update, files_to_update, files_to_remove = self.__does_component_needs_to_be_updated(original_vendored_component, updated_vendored_component, original_component)
if needs_update:
if self.__config.vendoring_enabled:
self.__tools_manager.atmos_vendor_component(updated_component)
Expand Down Expand Up @@ -248,7 +248,7 @@ def __clone_infra_for_component(self, infra_terraform_dir: str, component: Atmos
component_file = os.path.join(update_infra_repo_dir, component.relative_path)
return AtmosComponent(update_infra_repo_dir, infra_terraform_dir, component_file)

def __does_component_needs_to_be_updated(self, original_component: AtmosComponent, updated_component: AtmosComponent):
def __does_component_needs_to_be_updated(self, original_component: AtmosComponent, updated_component: AtmosComponent, original_component_source: AtmosComponent) -> (bool, List[str], List[str]):
updated_files = io.get_filenames_in_dir(updated_component.component_dir, ['**/*'])
original_files = io.get_filenames_in_dir(original_component.component_dir, ['**/*'])

Expand Down Expand Up @@ -290,8 +290,9 @@ def __does_component_needs_to_be_updated(self, original_component: AtmosComponen
for original_file in original_files:
relative_path = os.path.relpath(original_file, original_component.infra_repo_dir)
updated_file = os.path.join(updated_component.infra_repo_dir, relative_path)
source_file = os.path.join(original_component_source.infra_repo_dir, relative_path)

if not os.path.isfile(updated_file):
if os.path.isfile(source_file) and not os.path.isfile(updated_file):
logging.info(f"Remove file: {relative_path}")
files_to_remove.append(relative_path)
needs_update = True
Expand Down

0 comments on commit 893c450

Please sign in to comment.