fix: feat: task dispatcher — poll ops repo and launch runners (#45) #54

Merged
dev-qwen merged 4 commits from fix/issue-45 into main 2026-03-29 11:09:31 +00:00
Showing only changes of commit 6be0eee20b - Show all commits

View file

@ -48,8 +48,8 @@ log() {
# Clone or pull the ops repo # Clone or pull the ops repo
ensure_ops_repo() { ensure_ops_repo() {
if [ ! -d "${OPS_REPO_ROOT}/.git" ]; then if [ ! -d "${OPS_REPO_ROOT}/.git" ]; then
log "Cloning ops repo from ${FORGE_OPS_REPO}..." log "Cloning ops repo from ${FORGE_URL}/${FORGE_OPS_REPO}..."
git clone "${FORGE_OPS_REPO}" "${OPS_REPO_ROOT}" git clone "${FORGE_URL}/${FORGE_OPS_REPO}" "${OPS_REPO_ROOT}"
else else
log "Pulling latest ops repo changes..." log "Pulling latest ops repo changes..."
(cd "${OPS_REPO_ROOT}" && git pull --rebase) (cd "${OPS_REPO_ROOT}" && git pull --rebase)
@ -93,14 +93,28 @@ launch_runner() {
# Add environment variables BEFORE service name # Add environment variables BEFORE service name
for secret in "${secrets[@]+"${secrets[@]}"}"; do for secret in "${secrets[@]+"${secrets[@]}"}"; do
cmd+=(-e "${secret}=***") # Redact value in the command array cmd+=(-e "${secret}") # Pass actual value to container (from env)
done done
# Add formula and id as arguments (after service name) # Add formula and id as arguments (after service name)
cmd+=("$formula" "$id") cmd+=("$formula" "$id")
# Log command skeleton (secrets are redacted) # Log command skeleton (hide all -e flags for security)
log "Running: ${cmd[*]}" local -a log_cmd=()
local skip_next=0
for arg in "${cmd[@]}"; do
if [[ $skip_next -eq 1 ]]; then
skip_next=0
continue
fi
if [[ "$arg" == "-e" ]]; then
log_cmd+=("$arg" "<redacted>")
skip_next=1
else
log_cmd+=("$arg")
fi
done
log "Running: ${log_cmd[*]}"
# Execute with array expansion (safe from shell injection) # Execute with array expansion (safe from shell injection)
"${cmd[@]}" "${cmd[@]}"