@@ -125,14 +125,6 @@ jobs:
125125 - name : π§ͺ Run Java Unit Tests
126126 run : |
127127 echo "π§ͺ Running Java unit tests..."
128- <<<<<<< HEAD
129- cd server/user-service && ./mvnw test -q
130- cd ../workout-plan-service && ./mvnw test -q
131- cd ../tts-service && ./mvnw test -q
132- =======
133- cd server/user-service && chmod +x ./mvnw && ./mvnw test -Dspring.profiles.active=test
134- cd ../workout-plan-service && chmod +x ./mvnw && ./mvnw test -Dspring.profiles.active=test
135- >>>>>>> 8ee4364d68a838d9dfdbb262658698d1e9f4ec0b
136128 echo "β
Java unit tests completed"
137129
138130 - name : π§ͺ Run Python Unit Tests
@@ -364,190 +356,6 @@ jobs:
364356 with :
365357 version : ' latest'
366358
367- <<<<<<< HEAD
368- # Job 7: Deploy to Kubernetes (only for main branch)
369- deploy-k8s :
370- name : π Deploy to Kubernetes
371- runs-on : ubuntu-latest
372- needs : [setup, unit-tests, integration-tests, system-tests, build-package, build-and-push-ghcr]
373- if : always() && needs.setup.outputs.is_main == 'true' && needs.unit-tests.result == 'success' && (needs.integration-tests.result == 'success' || needs.integration-tests.result == 'skipped') && (needs.system-tests.result == 'success' || needs.system-tests.result == 'skipped')
374- steps :
375- - name : π₯ Checkout code
376- uses : actions/checkout@v4
377-
378- - name : π Configure AWS credentials
379- uses : aws-actions/configure-aws-credentials@v4
380- with :
381- aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
382- aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
383- aws-region : us-east-1
384-
385- - name : π§ Configure kubectl
386- run : |
387- aws eks update-kubeconfig --name flexfit-cluster-production --region us-east-1
388-
389- - name : π¦ Install Helm
390- run : |
391- curl https://get.helm.sh/helm-v3.12.0-linux-amd64.tar.gz | tar xz
392- sudo mv linux-amd64/helm /usr/local/bin/helm
393-
394- - name : π Deploy to Kubernetes
395- env :
396- GOOGLE_CREDENTIALS : ${{ secrets.GOOGLE_CREDENTIALS }}
397- CHAIR_API_KEY : ${{ secrets.CHAIR_API_KEY }}
398- run : |
399- # Create namespace if it doesn't exist
400- kubectl create namespace flexfit --dry-run=client -o yaml | kubectl apply -f -
401-
402- # Create Google credentials secret
403- kubectl create secret generic flexfit-google-credentials \
404- --from-literal=google-credentials.json="$GOOGLE_CREDENTIALS" \
405- --namespace flexfit --dry-run=client -o yaml | kubectl apply -f -
406-
407- # Deploy using Helm
408- helm upgrade --install flexfit ./helm/flexfit \
409- --namespace flexfit \
410- --set googleCredentials="$GOOGLE_CREDENTIALS" \
411- --set chairApiKey="$CHAIR_API_KEY" \
412- --set global.imageTag="${{ github.sha }}" \
413- --wait --timeout=10m
414-
415- - name : π₯ Health Check
416- run : |
417- echo "Waiting for services to be ready..."
418- kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=flexfit --namespace flexfit --timeout=300s
419-
420- echo "Checking service endpoints..."
421- kubectl get services -n flexfit
422- kubectl get pods -n flexfit
423-
424- # Job 8: Summary
425- summary :
426- name : π Pipeline Summary
427- runs-on : ubuntu-latest
428- needs : [setup, unit-tests, integration-tests, system-tests, build-package, build-and-push-ghcr, deploy-k8s]
429- =======
430- - name : π Configure Kubernetes context
431- run : |
432- echo "π§ Setting up TUM Kubernetes cluster access..."
433-
434- # Create .kube directory
435- mkdir -p ~/.kube
436-
437- # Write kubeconfig from GitHub secret
438- echo "${{ secrets.TUM_KUBECONFIG }}" | base64 -d > ~/.kube/config
439- chmod 600 ~/.kube/config
440-
441- # Verify connection
442- kubectl config current-context
443- kubectl version --client
444-
445- echo "β
Connected to TUM Kubernetes cluster"
446-
447- - name : π Set deployment environment
448- id : env
449- run : |
450- if [[ "${{ needs.setup.outputs.is_development }}" == "true" ]]; then
451- echo "namespace=team-code-compass-development" >> $GITHUB_OUTPUT
452- echo "values_file=values-tum.yaml" >> $GITHUB_OUTPUT
453- echo "environment=development" >> $GITHUB_OUTPUT
454- elif [[ "${{ needs.setup.outputs.is_main }}" == "true" ]]; then
455- echo "namespace=team-code-compass-production" >> $GITHUB_OUTPUT
456- echo "values_file=values-tum-production.yaml" >> $GITHUB_OUTPUT
457- echo "environment=production" >> $GITHUB_OUTPUT
458- else
459- echo "namespace=team-code-compass-development" >> $GITHUB_OUTPUT
460- echo "values_file=values-tum.yaml" >> $GITHUB_OUTPUT
461- echo "environment=development" >> $GITHUB_OUTPUT
462- fi
463-
464- - name : π Wait for image propagation
465- run : |
466- echo "β³ Waiting 30 seconds for GHCR images to propagate..."
467- sleep 30
468-
469- - name : π Deploy to Kubernetes using Helm
470- run : |
471- echo "π― Deploying to ${{ steps.env.outputs.environment }} environment"
472- echo "π¦ Namespace: ${{ steps.env.outputs.namespace }}"
473- echo "π Values file: ${{ steps.env.outputs.values_file }}"
474-
475- # Set required environment variables for deployment
476- export TUM_ID="${{ secrets.TUM_ID }}"
477- export CHAIR_API_KEY="${{ secrets.CHAIR_API_KEY }}"
478- export POSTGRES_PASSWORD="${{ secrets.POSTGRES_PASSWORD }}"
479- export GRAFANA_ADMIN_PASSWORD="${{ secrets.GRAFANA_ADMIN_PASSWORD }}"
480-
481- # Email alerts (optional)
482- export ALERT_EMAIL_FROM="${{ secrets.ALERT_EMAIL_FROM || 'hakanduranyt@gmail.com' }}"
483- export ALERT_EMAIL_TO="${{ secrets.ALERT_EMAIL_TO || 'hakanduranyt@gmail.com' }}"
484- export ALERT_EMAIL_USERNAME="${{ secrets.ALERT_EMAIL_USERNAME || 'hakanduranyt@gmail.com' }}"
485- export ALERT_EMAIL_PASSWORD="${{ secrets.ALERT_EMAIL_PASSWORD || 'your_gmail_app_password_here' }}"
486- export SMTP_HOST="${{ secrets.SMTP_HOST || 'smtp.gmail.com:587' }}"
487-
488- # Set IMAGE_TAG based on branch
489- if [[ "${{ needs.setup.outputs.is_main }}" == "true" ]]; then
490- export IMAGE_TAG="main"
491- echo "π·οΈ Using IMAGE_TAG=main for production deployment"
492- else
493- export IMAGE_TAG="latest"
494- echo "π·οΈ Using IMAGE_TAG=latest for development deployment"
495- fi
496-
497- # Validate required secrets
498- if [[ -z "$TUM_ID" || -z "$CHAIR_API_KEY" || -z "$POSTGRES_PASSWORD" || -z "$GRAFANA_ADMIN_PASSWORD" ]]; then
499- echo "β Missing required secrets. Please configure:"
500- echo " - TUM_ID"
501- echo " - CHAIR_API_KEY"
502- echo " - POSTGRES_PASSWORD"
503- echo " - GRAFANA_ADMIN_PASSWORD"
504- echo ""
505- echo "π Optional TUM Kubernetes secrets:"
506- echo " - TUM_KUBECONFIG (base64 encoded kubeconfig)"
507- echo " - TUM_NAMESPACE (e.g., ge85zat-devops25)"
508- echo " - TUM_INGRESS_HOST (e.g., ge85zat-devops25.student.k8s.aet.cit.tum.de)"
509- exit 1
510- fi
511-
512- # Deploy using envsubst and helm
513- cd helm/flexfit
514- envsubst < ${{ steps.env.outputs.values_file }} | \
515- helm upgrade --install flexfit . \
516- --namespace ${{ steps.env.outputs.namespace }} \
517- --create-namespace \
518- --wait \
519- --timeout=10m \
520- -f -
521-
522- - name : β
Verify deployment
523- run : |
524- echo "π Verifying deployment in ${{ steps.env.outputs.namespace }}"
525- kubectl get pods -n ${{ steps.env.outputs.namespace }}
526- kubectl get services -n ${{ steps.env.outputs.namespace }}
527-
528- echo "π Checking service health..."
529- kubectl wait --for=condition=ready pod -l app=frontend -n ${{ steps.env.outputs.namespace }} --timeout=300s || true
530- kubectl wait --for=condition=ready pod -l app=api-gateway -n ${{ steps.env.outputs.namespace }} --timeout=300s || true
531-
532- - name : π Deployment summary
533- run : |
534- echo "## π Deployment Summary" >> $GITHUB_STEP_SUMMARY
535- echo "- **Environment**: ${{ steps.env.outputs.environment }}" >> $GITHUB_STEP_SUMMARY
536- echo "- **Namespace**: ${{ steps.env.outputs.namespace }}" >> $GITHUB_STEP_SUMMARY
537- echo "- **Branch**: ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
538- echo "- **Commit**: ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
539- echo "" >> $GITHUB_STEP_SUMMARY
540- echo "### π¦ Deployed Services:" >> $GITHUB_STEP_SUMMARY
541- kubectl get pods -n ${{ steps.env.outputs.namespace }} --no-headers | while read line; do
542- echo "- $line" >> $GITHUB_STEP_SUMMARY
543- done
544-
545- # Job 6: Pipeline Summary
546- summary :
547- name : π Pipeline Summary
548- runs-on : ubuntu-latest
549- needs : [setup, unit-tests, integration-tests, build-and-push-ghcr, deploy-to-kubernetes]
550- >>>>>>> 8ee4364d68a838d9dfdbb262658698d1e9f4ec0b
551359 if : always()
552360 steps :
553361 - name : π Pipeline Results
@@ -562,16 +370,3 @@ jobs:
562370 echo " π§ͺ Unit Tests: ${{ needs.unit-tests.result || 'skipped' }}"
563371 echo " π Integration Tests: ${{ needs.integration-tests.result || 'skipped' }}"
564372 echo " π³ GHCR Push: ${{ needs.build-and-push-ghcr.result || 'skipped' }}"
565- <<<<<<< HEAD
566- echo " π Kubernetes Deploy : ${{ needs.deploy-k8s.result || 'skipped' }}"
567- echo ""
568-
569- if [ "${{ needs.unit-tests.result }}" == "success" ] && [ "${{ needs.integration-tests.result }}" != "failure" ] && [ "${{ needs.system-tests.result }}" != "failure" ]; then
570- echo "π Pipeline completed successfully!"
571- else
572- echo "β Pipeline failed - check logs for details"
573- fi
574- =======
575- echo " π Kubernetes Deploy : ${{ needs.deploy-to-kubernetes.result || 'skipped' }}"
576- echo ""
577- >>>>>>> 8ee4364d68a838d9dfdbb262658698d1e9f4ec0b
0 commit comments