fix: bug: WOODPECKER_REPO_ID not set in agent containers — ci-debug.sh fails to fetch logs, agents see "No logs available" (#599)
This commit is contained in:
parent
e092158fb0
commit
95aba008ac
1 changed files with 13 additions and 4 deletions
|
|
@ -39,7 +39,7 @@ try:
|
||||||
ci = cfg.get('ci', {})
|
ci = cfg.get('ci', {})
|
||||||
wp_id = ci.get('woodpecker_repo_id', '0')
|
wp_id = ci.get('woodpecker_repo_id', '0')
|
||||||
print(wp_id)
|
print(wp_id)
|
||||||
except:
|
except Exception:
|
||||||
print('0')
|
print('0')
|
||||||
" "$toml_file" 2>/dev/null || echo "0"
|
" "$toml_file" 2>/dev/null || echo "0"
|
||||||
else
|
else
|
||||||
|
|
@ -235,7 +235,7 @@ _generate_compose_impl() {
|
||||||
local wp_repo_id
|
local wp_repo_id
|
||||||
wp_repo_id=$(_get_primary_woodpecker_repo_id)
|
wp_repo_id=$(_get_primary_woodpecker_repo_id)
|
||||||
|
|
||||||
cat > "$compose_file" <<COMPOSEEOF_VAR
|
cat > "$compose_file" <<'COMPOSEEOF'
|
||||||
# docker-compose.yml — generated by disinto init
|
# docker-compose.yml — generated by disinto init
|
||||||
# Brings up Forgejo, Woodpecker, and the agent runtime.
|
# Brings up Forgejo, Woodpecker, and the agent runtime.
|
||||||
|
|
||||||
|
|
@ -341,7 +341,7 @@ services:
|
||||||
DISINTO_CONTAINER: "1"
|
DISINTO_CONTAINER: "1"
|
||||||
PROJECT_REPO_ROOT: /home/agent/repos/${PROJECT_NAME:-project}
|
PROJECT_REPO_ROOT: /home/agent/repos/${PROJECT_NAME:-project}
|
||||||
WOODPECKER_DATA_DIR: /woodpecker-data
|
WOODPECKER_DATA_DIR: /woodpecker-data
|
||||||
WOODPECKER_REPO_ID: "${WP_REPO_ID:-}"
|
WOODPECKER_REPO_ID: "PLACEHOLDER_WP_REPO_ID"
|
||||||
# IMPORTANT: agents get explicit environment variables (forge tokens, CI tokens, config).
|
# IMPORTANT: agents get explicit environment variables (forge tokens, CI tokens, config).
|
||||||
# Vault-only secrets (GITHUB_TOKEN, CLAWHUB_TOKEN, deploy keys) live in
|
# Vault-only secrets (GITHUB_TOKEN, CLAWHUB_TOKEN, deploy keys) live in
|
||||||
# .env.vault.enc and are NEVER injected here — only the runner
|
# .env.vault.enc and are NEVER injected here — only the runner
|
||||||
|
|
@ -438,12 +438,21 @@ volumes:
|
||||||
networks:
|
networks:
|
||||||
disinto-net:
|
disinto-net:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
COMPOSEEOF_VAR
|
COMPOSEEOF
|
||||||
|
|
||||||
# Patch PROJECT_REPO_ROOT — interpolate PROJECT_NAME at generation time
|
# Patch PROJECT_REPO_ROOT — interpolate PROJECT_NAME at generation time
|
||||||
# (Docker Compose cannot resolve it; it's a shell variable, not a .env var)
|
# (Docker Compose cannot resolve it; it's a shell variable, not a .env var)
|
||||||
sed -i "s|\${PROJECT_NAME:-project}|${PROJECT_NAME}|g" "$compose_file"
|
sed -i "s|\${PROJECT_NAME:-project}|${PROJECT_NAME}|g" "$compose_file"
|
||||||
|
|
||||||
|
# Patch WOODPECKER_REPO_ID — interpolate at generation time
|
||||||
|
# (Docker Compose cannot resolve it; it's a shell variable, not a .env var)
|
||||||
|
if [ -n "$wp_repo_id" ] && [ "$wp_repo_id" != "0" ]; then
|
||||||
|
sed -i "s|PLACEHOLDER_WP_REPO_ID|${wp_repo_id}|g" "$compose_file"
|
||||||
|
else
|
||||||
|
# Default to empty if no repo_id found (agents will handle gracefully)
|
||||||
|
sed -i "s|PLACEHOLDER_WP_REPO_ID||g" "$compose_file"
|
||||||
|
fi
|
||||||
|
|
||||||
# Patch the forgejo port mapping into the file if non-default
|
# Patch the forgejo port mapping into the file if non-default
|
||||||
if [ "$forge_port" != "3000" ]; then
|
if [ "$forge_port" != "3000" ]; then
|
||||||
# Add port mapping to forgejo service so it's reachable from host during init
|
# Add port mapping to forgejo service so it's reachable from host during init
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue