backend: Enhance OpenVidu Meet cleanup action with improved status reporting and error handling
This commit is contained in:
parent
6ab702e571
commit
710b2c0659
70
.github/actions/cleanup/action.yaml
vendored
70
.github/actions/cleanup/action.yaml
vendored
@ -3,42 +3,86 @@ description: 'Clean up OpenVidu Meet test environment'
|
|||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
|
- name: Show pre-cleanup status
|
||||||
|
run: |
|
||||||
|
echo "=== System status before cleanup ==="
|
||||||
|
df -h
|
||||||
|
free -h
|
||||||
|
echo "=== Running processes ==="
|
||||||
|
ps aux | grep -i 'npm\|node\|livekit' | grep -v grep || true
|
||||||
|
echo "=== Docker containers ==="
|
||||||
|
docker ps -a || true
|
||||||
|
shell: bash
|
||||||
|
|
||||||
- name: Kill backend process
|
- name: Kill backend process
|
||||||
run: pkill -f "npm run start:prod" || true
|
run: pkill -f "npm run start:prod" || true
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Stop OpenVidu Local Deployment containers
|
- name: Stop OpenVidu Local Deployment containers
|
||||||
run: |
|
run: |
|
||||||
cd openvidu-local-deployment/community
|
if [ -d "openvidu-local-deployment/community" ]; then
|
||||||
docker compose down -v
|
cd openvidu-local-deployment/community
|
||||||
|
docker compose down -v || echo "Warning: Failed to stop containers cleanly"
|
||||||
|
else
|
||||||
|
echo "Directory openvidu-local-deployment/community not found, skipping"
|
||||||
|
fi
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Clean up temporary files
|
- name: Clean up temporary files
|
||||||
run: |
|
run: |
|
||||||
rm -rf /tmp/openvidu-*
|
echo "Cleaning temporary files..."
|
||||||
rm -rf /tmp/livekit-*
|
rm -rf /tmp/openvidu-* || echo "Warning: Failed to clean some OpenVidu temp files"
|
||||||
|
rm -rf /tmp/livekit-* || echo "Warning: Failed to clean some LiveKit temp files"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Check for running containers
|
||||||
|
run: |
|
||||||
|
CONTAINERS=$(docker ps -q)
|
||||||
|
if [ -n "$CONTAINERS" ]; then
|
||||||
|
echo "Warning: Found running containers. Stopping them before prune."
|
||||||
|
docker stop $CONTAINERS || true
|
||||||
|
fi
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Clean up Docker resources
|
- name: Clean up Docker resources
|
||||||
run: docker system prune -f
|
run: |
|
||||||
|
echo "Pruning Docker system..."
|
||||||
|
docker system prune -f --volumes || echo "Warning: Docker system prune failed"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Kill orphaned processes
|
- name: Kill orphaned processes
|
||||||
run: |
|
run: |
|
||||||
ps aux | grep -i 'npm\|node\|livekit' | grep -v grep || true
|
echo "Checking for orphaned processes..."
|
||||||
ps aux | grep -i 'npm\|node\|livekit' | grep -v grep | awk '{print $2}' | xargs kill -9 || true
|
ORPHANED=$(ps aux | grep -i 'npm\|node\|livekit' | grep -v grep | awk '{print $2}')
|
||||||
shell: bash
|
if [ -n "$ORPHANED" ]; then
|
||||||
|
echo "Killing processes: $ORPHANED"
|
||||||
- name: Remove OpenVidu Meet directory
|
kill -9 $ORPHANED || echo "Warning: Some processes couldn't be killed"
|
||||||
run: |
|
else
|
||||||
if [ -d "/__w/openvidu-meet/openvidu-meet" ]; then
|
echo "No orphaned processes found"
|
||||||
sudo rm -rf /__w/openvidu-meet/openvidu-meet
|
|
||||||
fi
|
fi
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
- name: Clean specific directories
|
||||||
|
run: |
|
||||||
|
echo "Cleaning specific directories..."
|
||||||
|
# Don't try to remove the entire working directory
|
||||||
|
# Instead, clean specific subdirectories that might cause permission issues
|
||||||
|
|
||||||
|
if [ -d "openvidu-local-deployment" ]; then
|
||||||
|
sudo rm -rf openvidu-local-deployment || echo "Warning: Failed to remove openvidu-local-deployment"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clean build and cache directories
|
||||||
|
find . -type d -name "node_modules" -exec rm -rf {} +
|
||||||
|
find . -type d -name "dist" -exec rm -rf {} +
|
||||||
|
find . -type d -name ".cache" -exec rm -rf {} +
|
||||||
|
shell: bash
|
||||||
|
|
||||||
- name: Show system status
|
- name: Show system status
|
||||||
run: |
|
run: |
|
||||||
echo "=== System status after cleanup ==="
|
echo "=== System status after cleanup ==="
|
||||||
df -h
|
df -h
|
||||||
free -h
|
free -h
|
||||||
docker ps -a
|
docker ps -a
|
||||||
|
echo "=== Cleanup completed ==="
|
||||||
shell: bash
|
shell: bash
|
||||||
Loading…
x
Reference in New Issue
Block a user