diff --git a/.onedev-buildspec.yml b/.onedev-buildspec.yml index 11be2d8..eab9bce 100644 --- a/.onedev-buildspec.yml +++ b/.onedev-buildspec.yml @@ -9,8 +9,8 @@ jobs: interpreter: type: DefaultInterpreter commands: | - # 1. Install SSH client in this temporary CI container - apt-get update && apt-get install -y openssh-client + # 1. Install SSH client and IP routing tools + apt-get update && apt-get install -y openssh-client iproute2 # 2. Setup the SSH key from OneDev secrets mkdir -p ~/.ssh @@ -18,9 +18,12 @@ jobs: chmod 600 ~/.ssh/id_rsa echo "StrictHostKeyChecking no" > ~/.ssh/config - # 3. SSH into the host machine to execute the deployment - # Replace YOUR_HOST_LAN_IP with your machine's actual IP address (e.g. 192.168.1.50) - ssh adipu@@172.17.0.1 << 'EOF' + # 3. Dynamically find the Host machine's IP address + HOST_IP=$(ip route | awk '/default/ { print $3 }') + echo "==> Detected Host IP: $HOST_IP" + + # 4. SSH into the host machine to execute the deployment + ssh adipu@@$HOST_IP << 'EOF' set -e echo "==> Navigating to project directory..." cd ~/LabWise