From 80a44044152577c0df41f48e86147e72f77619bf Mon Sep 17 00:00:00 2001 From: Vishal Gupta Date: Fri, 3 Jan 2025 08:24:47 +0000 Subject: [PATCH] Skip git repo download --- .../executor/app/executor/import_executor.py | 18 ++++++++++++++---- import-automation/executor/main.py | 3 ++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/import-automation/executor/app/executor/import_executor.py b/import-automation/executor/app/executor/import_executor.py index 8396f9546..df815ae42 100644 --- a/import-automation/executor/app/executor/import_executor.py +++ b/import-automation/executor/app/executor/import_executor.py @@ -238,10 +238,20 @@ def _execute_imports_on_commit_helper( commit_sha, self.config.manifest_filename) with tempfile.TemporaryDirectory() as tmpdir: - repo_dir = self.github.download_repo( - tmpdir, commit_sha, self.config.repo_download_timeout) - - logging.info(f'Downloaded repo: {repo_dir}') + if self.local_repo_dir: + # Do not clone/download from GitHub. Instead, use the + # provided local path to the repo's root directory. + logging.info( + 'Using local repo at: %s', + self.local_repo_dir, + ) + repo_dir = self.local_repo_dir + else: + # Clone/download from GitHub. + logging.info('Downloading repo') + repo_dir = self.github.download_repo( + tmpdir, commit_sha, self.config.repo_download_timeout) + logging.info(f'Downloaded repo: {repo_dir}') imports_to_execute = import_target.find_imports_to_execute( targets=targets, diff --git a/import-automation/executor/main.py b/import-automation/executor/main.py index b64a0182b..693c931ad 100644 --- a/import-automation/executor/main.py +++ b/import-automation/executor/main.py @@ -31,7 +31,8 @@ def scheduled_updates(absolute_import_name: str, import_config: str): auth_access_token=config.github_auth_access_token), config=config, notifier=email_notifier.EmailNotifier(config.email_account, - config.email_token)) + config.email_token), + local_repo_dir='/workspace/data') result = executor.execute_imports_on_update(absolute_import_name) logging.info(result) if result.status == 'failed':