refactor: consolidate CI and local dev orchestration (#108)
## Summary - Extract shared bootstrap functions into `scripts/bootstrap-common.sh` (eliminates ~120 lines of duplicated forge/cast commands from e2e.yml) - Create reusable `scripts/wait-for-service.sh` for health checks (replaces 60-line inline wait-for-stack) - Merge dev and CI entrypoints into unified scripts branching on `CI` env var (delete `docker/ci-entrypoints/`) - Replace 4 per-service CI Dockerfiles with parameterized `docker/Dockerfile.service-ci` - Add `sync-tax-rates.mjs` to CI image builder stage - Fix: CI now grants txnBot recenter access (was missing) - Fix: txnBot funding parameterized (CI=10eth, local=1eth) - Delete 5 obsolete migration docs and 4 DinD integration files Net: -1540 lines removed Closes #107 ## Test plan - [ ] E2E pipeline passes (bootstrap sources shared script, services use old images with commands override) - [ ] build-ci-images pipeline builds all 4 services with unified Dockerfile - [ ] Local dev stack boots via `./scripts/dev.sh start` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: openhands <openhands@all-hands.dev> Reviewed-on: https://codeberg.org/johba/harb/pulls/108
This commit is contained in:
parent
4277f19b68
commit
e5e1308e72
45 changed files with 882 additions and 2627 deletions
62
containers/txnbot-entrypoint.sh
Executable file
62
containers/txnbot-entrypoint.sh
Executable file
|
|
@ -0,0 +1,62 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ "${CI:-}" == "true" ]]; then
|
||||
# ── CI path ────────────────────────────────────────────────────────
|
||||
echo "[txnbot-ci] Starting Transaction Bot..."
|
||||
|
||||
: "${TXNBOT_PRIVATE_KEY:?TXNBOT_PRIVATE_KEY is required}"
|
||||
: "${RPC_URL:?RPC_URL is required}"
|
||||
: "${KRAIKEN_ADDRESS:?KRAIKEN_ADDRESS is required}"
|
||||
: "${STAKE_ADDRESS:?STAKE_ADDRESS is required}"
|
||||
: "${LIQUIDITY_MANAGER_ADDRESS:?LIQUIDITY_MANAGER_ADDRESS is required}"
|
||||
|
||||
cat > /tmp/txnBot.env <<EOF
|
||||
TXNBOT_PRIVATE_KEY=${TXNBOT_PRIVATE_KEY}
|
||||
RPC_URL=${RPC_URL}
|
||||
KRAIKEN_ADDRESS=${KRAIKEN_ADDRESS}
|
||||
STAKE_ADDRESS=${STAKE_ADDRESS}
|
||||
LIQUIDITY_MANAGER_ADDRESS=${LIQUIDITY_MANAGER_ADDRESS}
|
||||
POOL_ADDRESS=${POOL_ADDRESS:-}
|
||||
WETH_ADDRESS=${WETH_ADDRESS:-0x4200000000000000000000000000000000000006}
|
||||
EOF
|
||||
|
||||
export TXN_BOT_ENV_FILE=/tmp/txnBot.env
|
||||
|
||||
echo "[txnbot-ci] Environment configured:"
|
||||
echo " RPC_URL: ${RPC_URL}"
|
||||
echo " KRAIKEN_ADDRESS: ${KRAIKEN_ADDRESS}"
|
||||
|
||||
echo "[txnbot-ci] Building TypeScript..."
|
||||
npm run build
|
||||
|
||||
exec npm run start
|
||||
fi
|
||||
|
||||
# ── Local dev path ─────────────────────────────────────────────────
|
||||
ROOT_DIR=/workspace
|
||||
|
||||
# shellcheck source=entrypoint-common.sh
|
||||
source "$ROOT_DIR/containers/entrypoint-common.sh"
|
||||
|
||||
entrypoint_checkout_branch "$ROOT_DIR" "txnbot-entrypoint"
|
||||
|
||||
TXNBOT_ENV_FILE=$ROOT_DIR/tmp/containers/txnBot.env
|
||||
BOT_DIR=$ROOT_DIR/services/txnBot
|
||||
|
||||
while [[ ! -f "$TXNBOT_ENV_FILE" ]]; do
|
||||
echo "[txnbot-entrypoint] waiting for env file"
|
||||
sleep 2
|
||||
done
|
||||
|
||||
entrypoint_require_kraiken_lib "$ROOT_DIR" "txnbot-entrypoint"
|
||||
|
||||
cd "$BOT_DIR"
|
||||
|
||||
entrypoint_install_deps "txnbot-entrypoint"
|
||||
|
||||
echo "[txnbot-entrypoint] Building TypeScript..."
|
||||
npm run build
|
||||
|
||||
export TXN_BOT_ENV_FILE="$TXNBOT_ENV_FILE"
|
||||
exec npm run start
|
||||
Loading…
Add table
Add a link
Reference in a new issue