Fix CI: Use gbuser home directory and restore original Setup Workspace
Some checks failed
BotServer CI/CD / build (push) Failing after 10s

- Changed WORKSPACE from /opt/gbo/data/botserver to /home/gbuser/workspace
- Changed CARGO_TARGET_DIR from /opt/gbo/data/botserver/target to /home/gbuser/target
- Restored original Setup Workspace approach that clones gb-ws and uses its Cargo.toml
- Uses shallow clones (--depth 1) for efficiency
- Only initializes necessary submodules (botlib and botserver)
- Updated build and deploy paths to use gbuser home directory

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-10 12:09:07 -03:00
parent 2634521d9e
commit aaccd741e3

View file

@ -10,8 +10,8 @@ env:
CARGO_BUILD_JOBS: 8 CARGO_BUILD_JOBS: 8
CARGO_NET_RETRY: 10 CARGO_NET_RETRY: 10
RUSTC_WRAPPER: sccache RUSTC_WRAPPER: sccache
WORKSPACE: /opt/gbo/data/botserver WORKSPACE: /home/gbuser/workspace
CARGO_TARGET_DIR: /opt/gbo/data/botserver/target CARGO_TARGET_DIR: /home/gbuser/target
PATH: /home/gbuser/.cargo/bin:/home/gbuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PATH: /home/gbuser/.cargo/bin:/home/gbuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
jobs: jobs:
@ -29,30 +29,23 @@ jobs:
mkdir -p $WORKSPACE mkdir -p $WORKSPACE
cd $WORKSPACE cd $WORKSPACE
# Create minimal Cargo.toml for building botserver only # Clone or update gb-ws (main workspace with Cargo.toml)
cat > Cargo.toml << 'EOF' if [ -d gb-ws/.git ]; then
[workspace] git -C gb-ws pull --ff-only origin main
members = ["botlib", "botserver"]
[workspace.dependencies]
# Empty - all deps defined in member crates
EOF
# Clone or update botlib
if [ -d botlib/.git ]; then
git -C botlib pull --ff-only origin main
else else
git clone --depth 1 --branch main https://alm.pragmatismo.com.br/GeneralBots/botlib.git botlib git clone --depth 1 --branch main https://alm.pragmatismo.com.br/GeneralBots/gb.git gb-ws
fi fi
# Clone or update botserver # Initialize and update submodules (only botlib and botserver needed)
if [ -d botserver/.git ]; then cd gb-ws
git -C botserver pull --ff-only origin main git submodule update --init --depth 1 botlib
else git submodule update --init --depth 1 botserver
git clone --depth 1 --branch main https://alm.pragmatismo.com.br/GeneralBots/BotServer.git botserver
fi
mkdir -p /opt/gbo/data/botserver/target # Pull latest updates from submodules
git -C botlib pull --ff-only origin main
git -C botserver pull --ff-only origin main
mkdir -p /home/gbuser/target
- name: Cache sccache - name: Cache sccache
uses: actions/cache@v4 uses: actions/cache@v4
@ -76,7 +69,7 @@ EOF
fi fi
- name: Build BotServer - name: Build BotServer
working-directory: /opt/gbo/data/botserver working-directory: /home/gbuser/workspace/gb-ws
run: | run: |
set -e set -e
# Kill any stuck cargo processes # Kill any stuck cargo processes
@ -101,13 +94,13 @@ EOF
SSH_ARGS="-i /home/gbuser/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o ConnectTimeout=5 -o ServerAliveInterval=5 -o ServerAliveCountMax=2 -o BatchMode=yes" SSH_ARGS="-i /home/gbuser/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o ConnectTimeout=5 -o ServerAliveInterval=5 -o ServerAliveCountMax=2 -o BatchMode=yes"
echo "=== Deploy started ===" echo "=== Deploy started ==="
echo "Step 1: Checking binary..." echo "Step 1: Checking binary..."
ls -lh /opt/gbo/data/botserver/target/debug/botserver ls -lh /home/gbuser/target/debug/botserver
echo "Step 2: Backing up old binary (ignore if not exists)..." echo "Step 2: Backing up old binary (ignore if not exists)..."
ssh $SSH_ARGS system "cp /opt/gbo/bin/botserver /tmp/botserver.bak 2>/dev/null || true" ssh $SSH_ARGS system "cp /opt/gbo/bin/botserver /tmp/botserver.bak 2>/dev/null || true"
echo "Step 3: Stopping botserver service..." echo "Step 3: Stopping botserver service..."
ssh $SSH_ARGS system "sudo systemctl stop botserver || true" ssh $SSH_ARGS system "sudo systemctl stop botserver || true"
echo "Step 4: Transferring new binary..." echo "Step 4: Transferring new binary..."
tar cf - -C /opt/gbo/data/botserver/target/debug botserver | gzip -1 | ssh $SSH_ARGS system "gzip -d | tar xf - -C /opt/gbo/bin && chmod +x /opt/gbo/bin/botserver && chown gbuser:gbuser /opt/gbo/bin/botserver && echo 'Transfer complete'" tar cf - -C /home/gbuser/target/debug botserver | gzip -1 | ssh $SSH_ARGS system "gzip -d | tar xf - -C /opt/gbo/bin && chmod +x /opt/gbo/bin/botserver && chown gbuser:gbuser /opt/gbo/bin/botserver && echo 'Transfer complete'"
echo "Step 5: Starting botserver service..." echo "Step 5: Starting botserver service..."
ssh $SSH_ARGS system "sudo systemctl start botserver && echo 'Botserver started'" ssh $SSH_ARGS system "sudo systemctl start botserver && echo 'Botserver started'"
echo "=== Deploy completed ===" echo "=== Deploy completed ==="