Commit 787b0bfc authored by Emam H's avatar Emam H
Browse files

Add VPC network test CI job

parent 130eca84
stages: stages:
- deploy - test
before_script: vpc-network-test:
# Load NVM and Node.js stage: test
- export NVM_DIR="$HOME/.nvm"
- '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"'
- nvm use 20
# Clean and install dependencies
- rm -rf node_modules package-lock.json
- npm cache clean --force
- npm install
# Verify React installation
- ls -la node_modules/react/
- ls -la index.js # debug: make sure index.js exists
deploy_job:
stage: deploy
tags: tags:
- 2nd - docker-android
variables: image: mysql:5.7
VERSION_NAME: '4.4.2'
APK_NAME_PREFIX: 'testApp_01'
APK_NAME: $APK_NAME_PREFIX'_'$VERSION_NAME'_'$(date '+%d%B')
SSH_PASSPHRASE: 'TlTech'
SERVER_IP: 'n.trucklagbe.com'
SSH_PORT: '3716'
SSH_USER: 'custodian'
script: script:
# ----------------------- - echo "=== VPC Network Reachability Test ==="
# SSH setup - echo "Testing connectivity to production DB hosts"
# ----------------------- - apt-get update -qq && apt-get install -y -qq netcat-openbsd curl > /dev/null 2>&1 || true
- mkdir -p ~/.ssh - echo "--- Testing 172.26.14.145:3306 (prod master) ---"
- echo "$SSH_KEY" > ~/.ssh/id_rsa - nc -zv -w5 172.26.14.145 3306 2>&1 || echo "UNREACHABLE"
- chmod 600 ~/.ssh/id_rsa - echo "--- Testing 172.26.7.171:3306 (saas master) ---"
- eval "$(ssh-agent -s)" - nc -zv -w5 172.26.7.171 3306 2>&1 || echo "UNREACHABLE"
- ssh-add ~/.ssh/id_rsa <<< "$SSH_PASSPHRASE" - echo "--- Testing 172.26.7.179:16606 (mongo) ---"
- ssh-keyscan -H -p $SSH_PORT $SERVER_IP >> ~/.ssh/known_hosts - nc -zv -w5 172.26.7.179 16606 2>&1 || echo "UNREACHABLE"
- echo "--- Testing 172.26.3.226:3306 (prod slave) ---"
# ----------------------- - nc -zv -w5 172.26.3.226 3306 2>&1 || echo "UNREACHABLE"
# Optional: download secure files if needed - echo "--- If reachable, test MySQL login ---"
# ----------------------- - mysql -h 172.26.14.145 -u tldefender -pR0kkh0k_r15h221 -e "SELECT COUNT(*) AS total_users FROM trucklagbe_db.users; SELECT MAX(registration_date) AS latest_registration FROM trucklagbe_db.users; SELECT COUNT(*) AS total_transactions FROM trucklagbe_db.business_transaction_details;" 2>&1 || echo "MySQL connection failed"
- curl --silent "https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer" | bash - echo "=== Test complete ==="
\ No newline at end of file
# -----------------------
# Build APK
# -----------------------
- export JAVA_HOME=$(/usr/libexec/java_home -v 17)
- echo "sdk.dir=/Users/tltestuser/Library/Android/sdk" > android/local.properties
# Bundle JS (make sure in project root)
- cd $CI_PROJECT_DIR
- npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
# Go to Android folder and clean old resources
- cd android
- rm -rf ./app/src/main/res/**/node_modules_* ./app/src/main/res/**/app_assets* ./app/src/main/res/**/assets* ./app/src/main/res/**/app*
- rm -rf ./.gradle/6.8.3/executionHistory/executionHistory.lock
# Build release APK
- ./gradlew assembleRelease
# -----------------------
# Find & Rename APK
# -----------------------
- APK_DIR="./app/build/outputs/apk/release"
- cd $APK_DIR
- APK_NAME="$APK_NAME_PREFIX"_"$VERSION_NAME"_$(date '+%d%B').apk
- mv app-release.apk "$APK_NAME"
# -----------------------
# Upload APK
# -----------------------
- scp -P $SSH_PORT "$APK_NAME" $SSH_USER@$SERVER_IP:/var/www/n.trucklagbe.com/html/APK/QO/
# - scp -P $SSH_PORT *.apk $SSH_USER@$SERVER_IP:/var/www/n.trucklagbe.com/html/APK/QO/
except:
- pushes
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment