From 53eacc352e322956a698f3a1a0e3641e50f77246 Mon Sep 17 00:00:00 2001 From: zwitschi Date: Wed, 12 Nov 2025 11:15:09 +0100 Subject: [PATCH] feat: Enhance deploy job to collect and upload Kubernetes deployment logs for staging and production --- .gitea/workflows/cicache.yml | 24 ++++++++++++++++++++++++ changelog.md | 1 + 2 files changed, 25 insertions(+) diff --git a/.gitea/workflows/cicache.yml b/.gitea/workflows/cicache.yml index 73a8e9d..962067c 100644 --- a/.gitea/workflows/cicache.yml +++ b/.gitea/workflows/cicache.yml @@ -262,6 +262,14 @@ jobs: # Wait for rollout kubectl rollout status deployment/calminer-app + - name: Collect staging deployment logs + if: github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[deploy staging]') + run: | + mkdir -p logs/deployment/staging + kubectl get pods -o wide > logs/deployment/staging/pods.txt + kubectl get deployment calminer-app -o yaml > logs/deployment/staging/deployment.yaml + kubectl logs deployment/calminer-app --all-containers=true --tail=500 > logs/deployment/staging/calminer-app.log + - name: Deploy to production if: github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[deploy production]') run: | @@ -272,3 +280,19 @@ jobs: kubectl apply -f k8s/secret.yaml # Wait for rollout kubectl rollout status deployment/calminer-app + + - name: Collect production deployment logs + if: github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[deploy production]') + run: | + mkdir -p logs/deployment/production + kubectl get pods -o wide > logs/deployment/production/pods.txt + kubectl get deployment calminer-app -o yaml > logs/deployment/production/deployment.yaml + kubectl logs deployment/calminer-app --all-containers=true --tail=500 > logs/deployment/production/calminer-app.log + + - name: Upload deployment logs + if: always() + uses: actions/upload-artifact@v4 + with: + name: deployment-logs + path: logs/deployment + if-no-files-found: ignore diff --git a/changelog.md b/changelog.md index 7df20fe..8741eb4 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,7 @@ - Diagnosed admin bootstrap failure caused by legacy `roles` schema, added Alembic migration `20251112_00_add_roles_metadata_columns.py` to backfill `display_name`, `description`, `created_at`, and `updated_at`, and verified the migration via full pytest run in the activated `.venv`. - Resolved Ruff E402 warnings by moving module docstrings ahead of `from __future__ import annotations` across currency and pricing service modules, dropped the unused `HTTPException` import in `monitoring/__init__.py`, and confirmed a clean `ruff check .` run. +- Enhanced the deploy job in `.gitea/workflows/cicache.yml` to capture Kubernetes pod, deployment, and container logs into `/logs/deployment/` for staging/production rollouts and publish them via a `deployment-logs` artifact, updating CI/CD documentation with retrieval instructions. ## 2025-11-11