Skip to content

Commit 852c5c3

Browse files
committed
runner configs
1 parent 5fe8ddc commit 852c5c3

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/ec2_gha/start.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,8 @@ def create_instances(self) -> dict[str, str]:
353353
"runner_registration_timeout": environ.get("INPUT_RUNNER_REGISTRATION_TIMEOUT", "").strip() or RUNNER_REGISTRATION_TIMEOUT,
354354
"runner_release": self.runner_release,
355355
"runners_per_instance": str(self.runners_per_instance),
356-
"runner_configs": json.dumps(runner_configs), # Always pass runner configs as JSON
356+
# Base64 encode the JSON to avoid shell escaping issues
357+
"runner_configs_b64": __import__('base64').b64encode(json.dumps(runner_configs).encode()).decode(),
357358
"script": self.script,
358359
"ssh_pubkey": self.ssh_pubkey,
359360
"token": base_token, # Keep for backward compatibility

src/ec2_gha/templates/user-script.sh.templ

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,11 @@ fi
373373
# Process each runner configuration
374374
log "Setting up $$RUNNERS_PER_INSTANCE runner(s)"
375375
python3 -c "
376-
import json, sys, os, subprocess, traceback
376+
import json, sys, os, subprocess, traceback, base64
377377
378-
# Runner configurations passed from Python
379-
runner_configs_json = '''$runner_configs'''
378+
# Runner configurations passed from Python (base64 encoded to avoid shell escaping issues)
379+
runner_configs_b64 = '$runner_configs_b64'
380+
runner_configs_json = base64.b64decode(runner_configs_b64).decode()
380381
381382
try:
382383
configs = json.loads(runner_configs_json)

0 commit comments

Comments
 (0)