Skip to content

Commit 76f08dd

Browse files
committed
Update orchestrator.py
1 parent c1ff5ca commit 76f08dd

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

orchestrator.py

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ def run(cmd, cwd=None):
200200
def clone_repo(repo, branch="demo-1"):
201201
"""
202202
Clone a repository and checkout a specific branch
203-
203+
204204
Args:
205205
repo (str): Repository name to clone
206206
branch (str): Branch name to checkout (default: demo-1)
207-
207+
208208
Returns:
209209
str: Repository directory name
210210
"""
@@ -239,9 +239,9 @@ def clone_repo(repo, branch="demo-1"):
239239
run(["git", "fetch"], cwd=repo)
240240
# Check if the branch exists remotely
241241
result = subprocess.run(
242-
["git", "ls-remote", "--heads", "origin", branch],
243-
cwd=repo,
244-
capture_output=True,
242+
["git", "ls-remote", "--heads", "origin", branch],
243+
cwd=repo,
244+
capture_output=True,
245245
text=True
246246
)
247247
if branch in result.stdout:
@@ -397,7 +397,7 @@ def create_env_files(repo_dir, config_dict):
397397
398398
This function creates .env files in each repository with the necessary
399399
environment variables such as GitHub tokens and HackMD API tokens.
400-
400+
401401
Args:
402402
repo_dir: Repository directory path
403403
config_dict: Configuration dictionary containing environment variables
@@ -408,29 +408,29 @@ def create_env_files(repo_dir, config_dict):
408408
# Check if the config has env settings
409409
if 'env' not in config_dict:
410410
return None
411-
411+
412412
env_path = Path(repo_dir) / ".env"
413413
env_content = []
414-
414+
415415
# Create or read existing .env file
416416
if env_path.exists():
417417
with open(env_path, 'r') as f:
418418
env_content = f.readlines()
419419
# Remove trailing newlines
420420
env_content = [line.rstrip() for line in env_content]
421-
421+
422422
# Get global.env to extract token values
423423
global_env_path = Path(__file__).parent / "global.env"
424424
global_env_vars = {}
425-
425+
426426
if global_env_path.exists():
427427
with open(global_env_path, 'r') as f:
428428
for line in f:
429429
line = line.strip()
430430
if line and not line.startswith('#') and '=' in line:
431431
key, value = line.split('=', 1)
432432
global_env_vars[key] = value
433-
433+
434434
# Process environment variables from the config
435435
for env_var_name, env_var_key in config_dict['env'].items():
436436
# Check if the env var already exists in the .env file
@@ -442,18 +442,18 @@ def create_env_files(repo_dir, config_dict):
442442
env_content[i] = f"{env_var_key}={global_env_vars[env_var_key]}"
443443
var_exists = True
444444
break
445-
445+
446446
# Add new entry if it doesn't exist
447447
if not var_exists:
448448
# Use value from global.env if available
449449
value = global_env_vars.get(env_var_key, "")
450450
env_content.append(f"{env_var_key}={value}")
451-
451+
452452
# Write the updated .env file
453453
with open(env_path, 'w') as f:
454454
for line in env_content:
455455
f.write(line + '\n')
456-
456+
457457
console.print(f"[bold green]Created/updated .env file at {env_path}[/bold green]")
458458
return env_path
459459

@@ -652,10 +652,13 @@ def main(is_docker=False, branch="demo-1"):
652652
cache_path = config_dict["koi_net"]["cache_directory_path"]
653653
first_contact = config_dict["koi_net"].get("first_contact", "")
654654
config_path = write_full_config(repo_dir, config_dict)
655-
install_requirements(repo_dir)
656-
655+
if not is_docker:
656+
install_requirements(repo_dir)
657+
else:
658+
console.print(f"[bold yellow]Skipping dependency installation for {repo_dir} (Docker mode)[/bold yellow]")
659+
657660
# Create or update .env file for the repository
658-
env_path = create_env_files(repo_dir, config_dict)
661+
create_env_files(repo_dir, config_dict)
659662

660663
# Generate Dockerfile if in Docker mode
661664
if is_docker:
@@ -678,7 +681,7 @@ def main(is_docker=False, branch="demo-1"):
678681
first_contact or "-"
679682
)
680683

681-
console.print(f"\nAll repos cloned, config.yaml written, and requirements installed with standard pip/venv.\n")
684+
console.print("\nAll repos cloned and config.yaml written. Requirements installed with standard pip/venv (skipped under Docker mode).\n")
682685
console.print(table)
683686

684687
console.print("\n[bold cyan]Port Configuration (All Modes):[/bold cyan]")

0 commit comments

Comments
 (0)