ci: use catthehacker/ubuntu:act-22.04 image with preinstalled tools
- Runner now uses act-compatible Ubuntu image - SSH and curl preinstalled, no need to install packages - Simplified workflow steps - All heavy work done via SSH on K3s server
This commit is contained in:
parent
e2fdea8f9e
commit
1f4bec9136
|
|
@ -8,11 +8,9 @@ on:
|
|||
env:
|
||||
K3S_HOST: "100.67.198.92"
|
||||
K3S_USER: "andres"
|
||||
NAMESPACE: "academia"
|
||||
DOMAIN: "academia.ingeniumcodex.com"
|
||||
|
||||
jobs:
|
||||
# Job: Build, Test y Deploy via SSH (no necesita checkout local)
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
|
@ -23,7 +21,7 @@ jobs:
|
|||
chmod 600 ~/.ssh/id_rsa
|
||||
ssh-keyscan -H ${{ env.K3S_HOST }} >> ~/.ssh/known_hosts 2>/dev/null
|
||||
|
||||
- name: Build, Test & Deploy on K3s
|
||||
- name: Deploy to K3s
|
||||
run: |
|
||||
ssh ${{ env.K3S_USER }}@${{ env.K3S_HOST }} 'bash -s' << 'ENDSSH'
|
||||
set -e
|
||||
|
|
@ -60,43 +58,33 @@ jobs:
|
|||
echo "=== Deploy complete ==="
|
||||
ENDSSH
|
||||
|
||||
# Smoke Tests
|
||||
smoke-tests:
|
||||
runs-on: ubuntu-latest
|
||||
needs: deploy
|
||||
steps:
|
||||
- name: Wait for services
|
||||
run: sleep 15
|
||||
|
||||
- name: Verify Production
|
||||
- name: Wait and Verify
|
||||
run: |
|
||||
sleep 15
|
||||
echo "Checking health..."
|
||||
curl -sf https://${{ env.DOMAIN }}/health | grep -q '"status":"Healthy"'
|
||||
|
||||
echo "Checking frontend..."
|
||||
curl -sf https://${{ env.DOMAIN }}/ | grep -q 'Sistema de Estudiantes'
|
||||
|
||||
echo "Checking GraphQL..."
|
||||
curl -sf -X POST https://${{ env.DOMAIN }}/graphql \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"query":"{ subjects { id } }"}' | grep -q '"subjects"'
|
||||
|
||||
echo "All checks passed!"
|
||||
|
||||
# Rollback on failure
|
||||
rollback:
|
||||
runs-on: ubuntu-latest
|
||||
needs: smoke-tests
|
||||
if: failure()
|
||||
steps:
|
||||
- name: Setup SSH
|
||||
- name: Setup SSH and Rollback
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.K3S_SSH_KEY }}" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
ssh-keyscan -H ${{ env.K3S_HOST }} >> ~/.ssh/known_hosts 2>/dev/null
|
||||
|
||||
- name: Rollback
|
||||
run: |
|
||||
ssh ${{ env.K3S_USER }}@${{ env.K3S_HOST }} \
|
||||
'sudo kubectl rollout undo deployment/student-api deployment/student-frontend -n academia'
|
||||
|
|
|
|||
Loading…
Reference in New Issue