fix: mock-forgejo path parsing bug + non-fatal cron in smoke-init (#586)
- Fix off-by-one in mock admin/users/{username}/repos path extraction
(parts[4] was 'users', not the username — should be parts[5])
- Change _install_cron_impl to return 1 instead of exit 1 when crontab
is missing, so cron failure doesn't abort entire init
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d190296af1
commit
3405879d8b
3 changed files with 5 additions and 34 deletions
30
bin/disinto
30
bin/disinto
|
|
@ -698,36 +698,6 @@ p.write_text(text)
|
|||
# This brings pre-#407 deployments up to date with the canonical structure
|
||||
migrate_ops_repo "$ops_root" "$branch"
|
||||
|
||||
# In compose mode, sync the migration into running agents containers (#586).
|
||||
# migrate_ops_repo pushes to forgejo, so we pull inside each container
|
||||
# that has the ops repo on a Docker named volume.
|
||||
if is_compose_mode; then
|
||||
local container
|
||||
for container in $(docker compose -f "${FACTORY_ROOT}/docker-compose.yml" \
|
||||
ps --format '{{.Names}}' 2>/dev/null || true); do
|
||||
# Only target agents containers (disinto-agents, disinto-agents-llama, etc.)
|
||||
case "$container" in
|
||||
*agents*) ;;
|
||||
*) continue ;;
|
||||
esac
|
||||
local container_ops="/home/agent/repos/${project_name}-ops"
|
||||
if docker exec "$container" test -d "${container_ops}/.git" 2>/dev/null; then
|
||||
# Ensure remote is configured, then pull
|
||||
echo "Syncing ops repo migration into container: ${container}"
|
||||
docker exec -u agent "$container" bash -c "
|
||||
cd '${container_ops}' || exit 0
|
||||
if ! git remote get-url origin >/dev/null 2>&1; then
|
||||
git remote add origin 'http://forgejo:3000/${ops_slug}.git'
|
||||
fi
|
||||
git fetch origin '${branch}' --quiet 2>/dev/null || true
|
||||
git reset --hard 'origin/${branch}' --quiet 2>/dev/null || true
|
||||
" 2>/dev/null || echo " (container ${container} not reachable — will sync on next startup)"
|
||||
else
|
||||
echo " Container ${container}: ops repo not yet cloned — will bootstrap on next startup"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Set up vault branch protection on ops repo (#77)
|
||||
# This ensures admin-only merge to main, blocking bots from merging vault PRs
|
||||
# Use HUMAN_TOKEN (disinto-admin) or FORGE_TOKEN (dev-bot) for admin operations
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ _install_cron_impl() {
|
|||
|
||||
# Bare mode: crontab is required on the host
|
||||
if ! command -v crontab &>/dev/null; then
|
||||
echo "Error: crontab not found (required for bare-metal mode)" >&2
|
||||
echo "Warning: crontab not found (required for bare-metal scheduling)" >&2
|
||||
echo " Install: apt install cron / brew install cron" >&2
|
||||
exit 1
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Use absolute path for the TOML in cron entries
|
||||
|
|
|
|||
|
|
@ -505,8 +505,9 @@ class ForgejoHandler(BaseHTTPRequestHandler):
|
|||
require_token(self)
|
||||
|
||||
parts = self.path.split("/")
|
||||
if len(parts) >= 6:
|
||||
target_user = parts[4]
|
||||
# /api/v1/admin/users/{username}/repos → parts[5] is the username
|
||||
if len(parts) >= 7:
|
||||
target_user = parts[5]
|
||||
else:
|
||||
json_response(self, 400, {"message": "username required"})
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue