690326:2236 Fixing Refactor ADR-019 Naming convention uuid #09
This commit is contained in:
@@ -71,13 +71,59 @@ jobs:
|
|||||||
- name: � Checkout
|
- name: � Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: � Setup SSH and Deploy to QNAP
|
- name: 🔐 Setup SSH and Deploy to QNAP
|
||||||
run: |
|
run: |
|
||||||
# Ensure sshpass is available (install if needed)
|
# Ensure sshpass is available (install if needed)
|
||||||
if ! command -v sshpass &> /dev/null; then
|
if ! command -v sshpass &> /dev/null; then
|
||||||
apt-get update -qq && apt-get install -y -qq sshpass
|
apt-get update -qq && apt-get install -y -qq sshpass
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Create remote deployment script
|
||||||
|
REMOTE_SCRIPT=$(cat << 'SCRIPT_EOF'
|
||||||
|
set -e
|
||||||
|
export PATH="/share/CACHEDEV1_DATA/.qpkg/container-station/bin:/opt/bin:/usr/local/bin:/usr/bin:/bin:$PATH"
|
||||||
|
|
||||||
|
echo "=========================================="
|
||||||
|
echo "Starting QNAP Deployment Process"
|
||||||
|
echo "=========================================="
|
||||||
|
|
||||||
|
# Verify Docker is accessible
|
||||||
|
if ! docker version > /dev/null 2>&1; then
|
||||||
|
echo "✗ Docker not accessible. Check Container Station."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "✓ Docker accessible"
|
||||||
|
|
||||||
|
# Sync scripts first
|
||||||
|
echo "📂 Syncing deployment scripts..."
|
||||||
|
cd /share/np-dms/app/source/lcbp3
|
||||||
|
|
||||||
|
# Check if directory exists
|
||||||
|
if [ ! -d ".git" ]; then
|
||||||
|
echo "✗ Git repository not found at expected path"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
git fetch origin main
|
||||||
|
git reset --hard origin/main
|
||||||
|
echo "✓ Code synced"
|
||||||
|
|
||||||
|
# Ensure scripts are executable
|
||||||
|
chmod +x scripts/deploy.sh scripts/rollback.sh 2>/dev/null || true
|
||||||
|
|
||||||
|
mkdir -p /share/np-dms/app/logs
|
||||||
|
|
||||||
|
# Clear Docker build cache to ensure fresh builds
|
||||||
|
echo "🧹 Clearing Docker build cache..."
|
||||||
|
docker builder prune -f || true
|
||||||
|
|
||||||
|
echo "🚀 Executing deployment..."
|
||||||
|
./scripts/deploy.sh
|
||||||
|
|
||||||
|
echo "✓ Deployment completed successfully"
|
||||||
|
SCRIPT_EOF
|
||||||
|
)
|
||||||
|
|
||||||
# Retry logic for SSH connection
|
# Retry logic for SSH connection
|
||||||
max_attempts=3
|
max_attempts=3
|
||||||
attempt=1
|
attempt=1
|
||||||
@@ -85,52 +131,10 @@ jobs:
|
|||||||
while [ $attempt -le $max_attempts ]; do
|
while [ $attempt -le $max_attempts ]; do
|
||||||
echo "🚀 Deployment attempt $attempt/$max_attempts..."
|
echo "🚀 Deployment attempt $attempt/$max_attempts..."
|
||||||
|
|
||||||
if sshpass -p "${{ secrets.PASSWORD }}" ssh -o StrictHostKeyChecking=no \
|
if echo "$REMOTE_SCRIPT" | sshpass -p "${{ secrets.PASSWORD }}" ssh -o StrictHostKeyChecking=no \
|
||||||
-o ConnectTimeout=30 \
|
-o ConnectTimeout=30 \
|
||||||
-o ServerAliveInterval=60 \
|
-o ServerAliveInterval=60 \
|
||||||
-p ${{ secrets.PORT }} ${{ secrets.USERNAME }}@${{ secrets.HOST }} << 'REMOTE_SCRIPT'
|
-p ${{ secrets.PORT }} ${{ secrets.USERNAME }}@${{ secrets.HOST }} 'bash -s'; then
|
||||||
set -e
|
|
||||||
export PATH="/share/CACHEDEV1_DATA/.qpkg/container-station/bin:/opt/bin:/usr/local/bin:/usr/bin:/bin:$PATH"
|
|
||||||
|
|
||||||
echo "=========================================="
|
|
||||||
echo "Starting QNAP Deployment Process"
|
|
||||||
echo "=========================================="
|
|
||||||
|
|
||||||
# Verify Docker is accessible
|
|
||||||
if ! docker version > /dev/null 2>&1; then
|
|
||||||
echo "✗ Docker not accessible. Check Container Station."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "✓ Docker accessible"
|
|
||||||
|
|
||||||
# Sync scripts first
|
|
||||||
echo "📂 Syncing deployment scripts..."
|
|
||||||
cd /share/np-dms/app/source/lcbp3
|
|
||||||
|
|
||||||
# Check if directory exists
|
|
||||||
if [ ! -d ".git" ]; then
|
|
||||||
echo "✗ Git repository not found at expected path"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
git fetch origin main
|
|
||||||
git reset --hard origin/main
|
|
||||||
echo "✓ Code synced"
|
|
||||||
|
|
||||||
# Ensure scripts are executable
|
|
||||||
chmod +x scripts/deploy.sh scripts/rollback.sh 2>/dev/null || true
|
|
||||||
|
|
||||||
mkdir -p /share/np-dms/app/logs
|
|
||||||
|
|
||||||
# Clear Docker build cache to ensure fresh builds
|
|
||||||
echo "🧹 Clearing Docker build cache..."
|
|
||||||
docker builder prune -f || true
|
|
||||||
|
|
||||||
echo "🚀 Executing deployment..."
|
|
||||||
./scripts/deploy.sh
|
|
||||||
|
|
||||||
echo "✓ Deployment completed successfully"
|
|
||||||
REMOTE_SCRIPT; then
|
|
||||||
echo "✅ Deployment successful!"
|
echo "✅ Deployment successful!"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user