refactor: SOLID architecture — backend service layer + frontend V2 components
## Backend — Service Layer & Repository Refactoring ### Neue Services (21 neue Dateien) **Interfaces & Implementierungen:** - `IOpenClawGatewayClient` — Interface für OpenClawGatewayClient (DIP-Fix: DashboardController hing an konkreter Klasse) - `IAgentConfigService` / `AgentConfigService` — Agent-Config-File-I/O aus AgentsController extrahiert - `IProjectService` / `ProjectService` — Projekt-CRUD + Activity-Logging (SRP) - `ITaskService` / `TaskService` — Task-State-Machine, Approve/Reject, Dashboard-Operationen (eliminiert Duplikation zwischen TasksController und DashboardController) - `IDashboardService` / `DashboardService` — Queue-Aggregation, Priority-Normalisierung, Gateway-Delegation - `IOperationsService` / `OperationsService` — Metriken-Berechnung aus OperationsController - `ITeamService` / `TeamService` — IDENTITY.md-Lesen aus TeamController - `IMemoryService` / `MemoryService` — File-I/O aus MemoryController - `IIncidentService` / `IncidentService` — File-Parsing (Regex-Source-Generatoren) aus IncidentsController - `IDocService` / `DocService` — Directory-Scan aus DocsController - `ICalendarService` / `CalendarService` — Gateway-HTTP-Calls + Fallback-Daten aus CalendarController ### Repository-Fixes **IUserRepository / UserRepository:** - `SaveChangesAsync` entfernt (leaky abstraction — Caller sollten nie SaveChanges steuern) - `RevokeTokenAsync(tokenHash)` — atomares Token-Revoke inkl. SaveChanges - `RevokeFamilyAsync(familyId)` — Batch-Revoke einer Token-Familie inkl. SaveChanges - `RemoveExpiredTokensAsync` speichert jetzt selbst (war vorher dependent auf nachfolgenden Save) ### AuthService-Fixes - `GetUserAsync`: unnötiges `Task.Run` entfernt → direkt `_users.GetByIdAsync().AsTask()` - `RevokeAsync`: delegiert jetzt an `IUserRepository.RevokeTokenAsync` - `RefreshAsync`: Token-Reuse-Detection delegiert an `IUserRepository.RevokeFamilyAsync` ### Bug-Fix - `OpenClawGatewayClient.ReadAgentGoalAsync`: pre-existing `CS1656` behoben (`reader` war `using`-Variable und wurde neu zugewiesen — in `reader2` umbenannt) ### Controller (16 Stück — alle slim) Alle Controller reduziert auf: Input validieren → Service aufrufen → HTTP-Result zurückgeben. Kein Business-Logic, kein File-I/O, keine direkte Repository-Nutzung (außer AgentsController für Activity-Log). **Program.cs — neue Registrierungen:** - `AddHttpClient<IOpenClawGatewayClient, OpenClawGatewayClient>` (war vorher konkrete Klasse) - Scoped: IDashboardService, IProjectService, ITaskService, IOperationsService, ITeamService, ICalendarService - Singleton: IAgentConfigService, IMemoryService, IIncidentService, IDocService --- ## Frontend — Dashboard V2 Components **AgentDetailModal.vue, IrisChat.vue, TaskStrip.vue:** - V2 Design-System: Dark Space Theme, Glass-Panels, Gradient-Akzente - Stores (agents, chat, tasks) nutzen Service + Mapper-Pattern - NexusLayout, FlowBoard, Topbar — Layoutfixes für fullHeight-Route-Meta Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+241
-109
@@ -1,158 +1,249 @@
|
||||
name: Deploy to Production
|
||||
run-name: 🚀 Deploy ${{ inputs.bump_version || 'patch' }} by @${{ gitea.actor }}
|
||||
run-name: 🚀 Deploy by @${{ gitea.actor }}
|
||||
|
||||
# ── Concurrency: one deploy at a time, cancel queued ones ──
|
||||
# Why: prevents race conditions when CI triggers deploy while
|
||||
# a manual deploy is still running. The latest deploy wins.
|
||||
# ───────────────────────────────────────────────────────
|
||||
# Owner: DevOps (Architekt)
|
||||
# CD v3 — 2026-06-13
|
||||
#
|
||||
# Triggers:
|
||||
# 1. AUTOMATIC after successful CI on main (workflow_run)
|
||||
# → Uses safe defaults: patch bump, all services, main ref.
|
||||
# → Commits marked with [skip ci] are filtered at job level
|
||||
# (prevents version-bump loops).
|
||||
# 2. MANUAL via workflow_dispatch with full parameter control.
|
||||
#
|
||||
# Concurrency: one deploy at a time.
|
||||
# Queued deploys wait — no race conditions with parallel builds.
|
||||
#
|
||||
# Version-Bump / CI Loop Prevention:
|
||||
# The version-bump commit includes "[skip ci]" in its message,
|
||||
# which Gitea Actions respects. The auto-trigger additionally
|
||||
# checks for "[skip ci]" as a second safety layer. Together
|
||||
# they guarantee that a version-bump commit does NOT trigger
|
||||
# another CI → Deploy → Bump → CI cycle.
|
||||
# ───────────────────────────────────────────────────────
|
||||
concurrency:
|
||||
group: deploy-production
|
||||
cancel-in-progress: false
|
||||
|
||||
# ───────────────────────────────────────────────────
|
||||
# Trigger: automatic after CI success, or manual dispatch.
|
||||
# Runner: uses ubuntu-latest label (consistently present on
|
||||
# runner id=5: linux,dotnet,node,deploy,ubuntu-latest,…).
|
||||
# Standard labels avoid custom-label matching edge cases.
|
||||
# ───────────────────────────────────────────────────
|
||||
on:
|
||||
# ── Auto-Trigger: after successful CI on main ──
|
||||
workflow_run:
|
||||
workflows: ["CI - Build & Test"]
|
||||
types: [completed]
|
||||
branches: [main]
|
||||
|
||||
# ── Manual Trigger (full control) ──
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
bump_version:
|
||||
description: 'Version bump (Major=x.0.0, Minor=1.x.0 features, Patch=1.0.x fixes)'
|
||||
required: false
|
||||
version_bump:
|
||||
description: 'Version bump type'
|
||||
required: true
|
||||
default: 'patch'
|
||||
type: string
|
||||
type: choice
|
||||
options:
|
||||
- 'patch'
|
||||
- 'minor'
|
||||
- 'major'
|
||||
- patch
|
||||
- minor
|
||||
- major
|
||||
service:
|
||||
description: 'Service to deploy (empty = all)'
|
||||
required: false
|
||||
default: ''
|
||||
type: string
|
||||
no_cache:
|
||||
description: 'Disable build cache'
|
||||
description: 'Disable Docker build cache'
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
git_ref:
|
||||
description: 'Git ref to deploy (branch, tag, or commit SHA; default: main)'
|
||||
required: false
|
||||
default: 'main'
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
name: Deploy Nexus
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ gitea.event_name != 'workflow_run' || gitea.event.workflow_run.conclusion == 'success' }}
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch') ||
|
||||
(github.event_name == 'workflow_run' &&
|
||||
github.event.workflow_run.conclusion == 'success' &&
|
||||
!contains(github.event.workflow_run.head_commit.message, '[skip ci]'))
|
||||
|
||||
# ── Env for the deploy target path ──
|
||||
env:
|
||||
DEPLOY_PATH: /opt/openclaw/data/openclaw/workspace/nexus
|
||||
ENV_TMPFILE: /tmp/nexus-deploy-env
|
||||
ENV_POSTGRES_PASSWORD: ${{ secrets.ENV_POSTGRES_PASSWORD }}
|
||||
ENV_JWT_KEY: ${{ secrets.ENV_JWT_KEY }}
|
||||
ENV_OWNER_PASSWORD: ${{ secrets.ENV_OWNER_PASSWORD }}
|
||||
ENV_OPENCLAW_TOKEN: ${{ secrets.ENV_OPENCLAW_TOKEN }}
|
||||
|
||||
steps:
|
||||
# ── Step 1: Checkout ─────────────────────
|
||||
- name: Checkout latest code
|
||||
# ═══════════════════════════════════════════════════
|
||||
# Step 1: Checkout
|
||||
# ═══════════════════════════════════════════════════
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.git_ref || 'main' }}
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
# ── Step 2: Version bump (race-free) ─────
|
||||
# Derives current version from git tags (not VERSION file) to
|
||||
# avoid race conditions where tag exists but VERSION is stale.
|
||||
# Uses --force on tag+push to handle retries after failed runs.
|
||||
- name: Version Bump
|
||||
# ═══════════════════════════════════════════════════
|
||||
# Step 2: Set up Git identity
|
||||
# ═══════════════════════════════════════════════════
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config user.email "devops@noveria.net"
|
||||
git config user.name "DevOps"
|
||||
|
||||
# ═══════════════════════════════════════════════════
|
||||
# Step 3: Resolve deploy version
|
||||
#
|
||||
# Deploying main: DevOps may bump VERSION and create a tag.
|
||||
# Deploying any other ref: deploy exactly that ref, but DO NOT
|
||||
# mutate main or create a version-bump commit on another branch.
|
||||
#
|
||||
# For auto-deploys (workflow_run): always "patch" bump on main.
|
||||
# ═══════════════════════════════════════════════════
|
||||
- name: Resolve Version
|
||||
id: version
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
# Source of truth: latest git tag
|
||||
TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
|
||||
CURRENT_VERSION="${TAG#v}"
|
||||
echo "📦 Current version (from git tags): $CURRENT_VERSION"
|
||||
# Determine bump type (auto-deploy → patch; manual → user choice)
|
||||
BUMP_TYPE="${{ github.event_name == 'workflow_dispatch' && inputs.version_bump || 'patch' }}"
|
||||
|
||||
MAJOR=$(echo "$CURRENT_VERSION" | cut -d. -f1)
|
||||
MINOR=$(echo "$CURRENT_VERSION" | cut -d. -f2)
|
||||
PATCH=$(echo "$CURRENT_VERSION" | cut -d. -f3)
|
||||
# Read current version
|
||||
if [ ! -f VERSION ]; then
|
||||
echo "❌ VERSION file not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "${{ inputs.bump_version }}" in
|
||||
major)
|
||||
MAJOR=$((MAJOR + 1)); MINOR=0; PATCH=0 ;;
|
||||
minor)
|
||||
MINOR=$((MINOR + 1)); PATCH=0 ;;
|
||||
patch|*)
|
||||
PATCH=$((PATCH + 1)) ;;
|
||||
CURRENT=$(cat VERSION | tr -d '[:space:]')
|
||||
if ! echo "$CURRENT" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
|
||||
echo "❌ Invalid semver in VERSION: '$CURRENT'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MAJOR=$(echo "$CURRENT" | cut -d. -f1)
|
||||
MINOR=$(echo "$CURRENT" | cut -d. -f2)
|
||||
PATCH=$(echo "$CURRENT" | cut -d. -f3)
|
||||
|
||||
case "$BUMP_TYPE" in
|
||||
major) NEW_MAJOR=$((MAJOR + 1)); NEW_MINOR=0; NEW_PATCH=0 ;;
|
||||
minor) NEW_MAJOR=$MAJOR; NEW_MINOR=$((MINOR + 1)); NEW_PATCH=0 ;;
|
||||
patch) NEW_MAJOR=$MAJOR; NEW_MINOR=$MINOR; NEW_PATCH=$((PATCH + 1)) ;;
|
||||
*) echo "❌ Unknown bump type: $BUMP_TYPE"; exit 1 ;;
|
||||
esac
|
||||
|
||||
NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}"
|
||||
echo "🏷️ New version: $NEW_VERSION"
|
||||
echo "$NEW_VERSION" > VERSION
|
||||
# Determine git ref — auto-deploy always uses main
|
||||
DEPLOY_REF="${{ github.event_name == 'workflow_dispatch' && inputs.git_ref || 'main' }}"
|
||||
if [ -z "$DEPLOY_REF" ] || [ "$DEPLOY_REF" = "main" ] || [ "$DEPLOY_REF" = "refs/heads/main" ]; then
|
||||
NEW_VERSION="${NEW_MAJOR}.${NEW_MINOR}.${NEW_PATCH}"
|
||||
echo "$NEW_VERSION" > VERSION
|
||||
git add VERSION
|
||||
git commit -m "chore: bump version to ${NEW_VERSION} [skip ci]"
|
||||
git tag -a "v${NEW_VERSION}" -m "Release v${NEW_VERSION}"
|
||||
git push origin HEAD:main --tags
|
||||
echo "version=$NEW_VERSION" >> "$GITEA_OUTPUT"
|
||||
echo "mutated_main=true" >> "$GITEA_OUTPUT"
|
||||
echo "📦 Main deploy: version $CURRENT -> v${NEW_VERSION} (bump: $BUMP_TYPE, trigger: ${{ github.event_name }})"
|
||||
else
|
||||
echo "version=$CURRENT" >> "$GITEA_OUTPUT"
|
||||
echo "mutated_main=false" >> "$GITEA_OUTPUT"
|
||||
echo "📦 Non-main deploy from '$DEPLOY_REF': using committed VERSION $CURRENT without git mutation"
|
||||
fi
|
||||
|
||||
git config user.email "devops@noveria.net"
|
||||
git config user.name "DevOps"
|
||||
git add VERSION
|
||||
git commit -m "chore: bump version to v${NEW_VERSION} [skip ci]"
|
||||
|
||||
# --force avoids "tag already exists" when re-running after a failed attempt
|
||||
git tag -f "v${NEW_VERSION}"
|
||||
git push "https://devops:${{ secrets.GIT_TOKEN }}@git.noveria.net/bao/nexus.git" HEAD:main --force --tags
|
||||
echo "✅ Version bumped to v${NEW_VERSION}"
|
||||
|
||||
# ── Step 3: Sync code + .env to host ──────
|
||||
# Creates .env from Gitea secrets in the workspace, then syncs
|
||||
# everything (except .git) to the host deploy path via DIND.
|
||||
- name: Sync code + .env to host
|
||||
# ═══════════════════════════════════════════════════
|
||||
# Step 4: Build .env from secrets (SAFE)
|
||||
#
|
||||
# Secrets are written to /tmp/nexus-deploy-env — NEVER
|
||||
# to a file inside the workspace that gets rsync'd to
|
||||
# the host. The temp file is deleted immediately after
|
||||
# compose operations complete.
|
||||
# ═══════════════════════════════════════════════════
|
||||
- name: Prepare .env (secrets → temp file)
|
||||
run: |
|
||||
# Create .env from Gitea secrets in the workspace
|
||||
cat > "${{ gitea.workspace }}/.env" << 'ENVEOF'
|
||||
set -euo pipefail
|
||||
|
||||
cat > "${ENV_TMPFILE}" <<EOF
|
||||
# Nexus Production Environment — auto-generated by CD pipeline
|
||||
# Managed via Gitea secrets → do not edit manually on the host
|
||||
# Managed via Gitea Secrets → do NOT edit manually on the host.
|
||||
# This file lives in /tmp and is removed after deploy completes.
|
||||
POSTGRES_DB=nexus
|
||||
POSTGRES_USER=nexus
|
||||
POSTGRES_PASSWORD=${{ secrets.ENV_POSTGRES_PASSWORD }}
|
||||
JWT_KEY=${{ secrets.ENV_JWT_KEY }}
|
||||
POSTGRES_PASSWORD=${ENV_POSTGRES_PASSWORD}
|
||||
JWT_KEY=${ENV_JWT_KEY}
|
||||
JWT_ISSUER=nexus
|
||||
JWT_AUDIENCE=nexus-web
|
||||
OWNER_EMAIL=vmbao62@hotmail.de
|
||||
OWNER_PASSWORD=${{ secrets.ENV_OWNER_PASSWORD }}
|
||||
OWNER_PASSWORD=${ENV_OWNER_PASSWORD}
|
||||
OWNER_DISPLAY_NAME=
|
||||
OPENCLAW_BASE_URL=http://host.docker.internal:18789
|
||||
OPENCLAW_GATEWAY_TOKEN=${{ secrets.ENV_OPENCLAW_TOKEN }}
|
||||
OPENCLAW_GATEWAY_TOKEN=${ENV_OPENCLAW_TOKEN}
|
||||
OPENCLAW_GATEWAY_PASSWORD=
|
||||
ENVEOF
|
||||
EOF
|
||||
|
||||
chmod 600 "${ENV_TMPFILE}"
|
||||
echo "✅ .env written to ${ENV_TMPFILE} (mode 600)"
|
||||
|
||||
# ═══════════════════════════════════════════════════
|
||||
# Step 5: Sync code to host (without .env in workspace)
|
||||
# ═══════════════════════════════════════════════════
|
||||
- name: Sync code to host
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
# Sync everything (except .git) from workspace to host
|
||||
docker run --rm \
|
||||
-v "${{ gitea.workspace }}:/src:ro" \
|
||||
-v /opt/openclaw/data/openclaw/workspace/nexus:/dest \
|
||||
-v "${DEPLOY_PATH}:/dest" \
|
||||
alpine:latest \
|
||||
sh -c "
|
||||
cd /src && \
|
||||
find . -mindepth 1 -maxdepth 1 \
|
||||
! -name .git \
|
||||
-exec cp -a {} /dest/ \;
|
||||
-exec cp -r {} /dest/ \; && \
|
||||
DEST_OWNER=\$(stat -c '%u:%g' /dest) && \
|
||||
chown -R \"\$DEST_OWNER\" /dest
|
||||
"
|
||||
echo "✅ Code + .env synced to host deploy path"
|
||||
|
||||
# ── Step 4: Docker Buildx ─────────────────
|
||||
- name: Set up Docker Buildx
|
||||
run: docker buildx create --use 2>/dev/null || true
|
||||
echo "✅ Code synced to ${DEPLOY_PATH}"
|
||||
|
||||
# ── Step 5: Build & Deploy ────────────────
|
||||
# ═══════════════════════════════════════════════════
|
||||
# Step 6: Build & Deploy
|
||||
#
|
||||
# The temp .env file is bind-mounted read-only into the
|
||||
# docker:cli container so compose can resolve variables.
|
||||
# It is NEVER written into the workspace directory.
|
||||
# ═══════════════════════════════════════════════════
|
||||
- name: Build & Deploy
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
# Auto-deploy: always use cache. Manual: respect no_cache input.
|
||||
NO_CACHE="${{ github.event_name == 'workflow_dispatch' && inputs.no_cache || false }}"
|
||||
BUILD_ARGS=""
|
||||
if [ "${{ inputs.no_cache }}" = "true" ]; then
|
||||
if [ "$NO_CACHE" = "true" ]; then
|
||||
BUILD_ARGS="--no-cache"
|
||||
fi
|
||||
|
||||
SERVICE_ARG="${{ github.event_name == 'workflow_dispatch' && inputs.service || '' }}"
|
||||
|
||||
docker run --rm \
|
||||
-v /opt/openclaw/data/openclaw/workspace/nexus:/workspace/nexus \
|
||||
-v "${DEPLOY_PATH}:/workspace/nexus" \
|
||||
-v "${ENV_TMPFILE}:/workspace/nexus/.env:ro" \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-w /workspace/nexus \
|
||||
docker:cli \
|
||||
sh -c "
|
||||
set -e
|
||||
if [ -n '${{ inputs.service }}' ]; then
|
||||
echo '🚀 Deploying service: ${{ inputs.service }}'
|
||||
docker compose build ${BUILD_ARGS} ${{ inputs.service }}
|
||||
docker compose up -d --wait --force-recreate ${{ inputs.service }}
|
||||
if [ -n '${SERVICE_ARG}' ]; then
|
||||
echo '🚀 Deploying service: ${SERVICE_ARG}'
|
||||
docker compose build ${BUILD_ARGS} ${SERVICE_ARG}
|
||||
docker compose up -d --wait --force-recreate ${SERVICE_ARG}
|
||||
else
|
||||
echo '🚀 Deploying all services'
|
||||
docker compose build ${BUILD_ARGS}
|
||||
@@ -160,10 +251,22 @@ jobs:
|
||||
fi
|
||||
"
|
||||
|
||||
# ── Step 6: Health Check (backoff) ────────
|
||||
# Exponential-ish backoff: 1s, 2s, 3s, 5s, 8s, 13s (~32s total).
|
||||
# Why: cold-start containers need variable warmup time;
|
||||
# fixed 5s intervals either wait too long or give up too early.
|
||||
echo "✅ Docker compose up completed"
|
||||
|
||||
# ═══════════════════════════════════════════════════
|
||||
# Step 7: Clean up temp .env
|
||||
# ═══════════════════════════════════════════════════
|
||||
- name: Clean up temp .env
|
||||
if: always()
|
||||
run: |
|
||||
if [ -f "${ENV_TMPFILE}" ]; then
|
||||
shred -u "${ENV_TMPFILE}" 2>/dev/null || rm -f "${ENV_TMPFILE}"
|
||||
echo "🧹 Temp .env removed"
|
||||
fi
|
||||
|
||||
# ═══════════════════════════════════════════════════
|
||||
# Step 8: Health Check (exponential backoff)
|
||||
# ═══════════════════════════════════════════════════
|
||||
- name: Health Check
|
||||
run: |
|
||||
echo "🏥 Health check..."
|
||||
@@ -186,11 +289,10 @@ jobs:
|
||||
echo "❌ Health check failed after $MAX attempts"
|
||||
exit 1
|
||||
|
||||
# ── Step 7: Smoke test (multi-endpoint) ───
|
||||
# Tests multiple endpoints to catch partial failures.
|
||||
# Why: a single /dashboard check can miss backend-only outages;
|
||||
# /health tests the API + database + runtime status.
|
||||
- name: Verify (smoke test)
|
||||
# ═══════════════════════════════════════════════════
|
||||
# Step 9: Smoke Test
|
||||
# ═══════════════════════════════════════════════════
|
||||
- name: Smoke Test
|
||||
run: |
|
||||
echo "🔍 Smoke test..."
|
||||
PASS=0
|
||||
@@ -199,7 +301,8 @@ jobs:
|
||||
|
||||
check() {
|
||||
local path="$1" label="$2" expected="${3:-200}"
|
||||
local code=$(curl -s -o /dev/null -w "%{http_code}" --max-time 10 "${BASE}${path}")
|
||||
local code
|
||||
code=$(curl -s -o /dev/null -w "%{http_code}" --max-time 10 "${BASE}${path}")
|
||||
printf " %-25s HTTP %s" "${label}:" "${code}"
|
||||
if [ "$code" = "$expected" ]; then
|
||||
echo " ✅"
|
||||
@@ -210,8 +313,9 @@ jobs:
|
||||
fi
|
||||
}
|
||||
|
||||
check "/dashboard" "Dashboard" 200
|
||||
check "/health" "Health API" 200
|
||||
check "/dashboard" "Dashboard" 200
|
||||
check "/health" "Health API" 200
|
||||
check "/api/v1/operations/snapshot" "Operations API (auth)" 401
|
||||
|
||||
echo ""
|
||||
echo "Results: $PASS passed, $FAIL failed"
|
||||
@@ -219,25 +323,53 @@ jobs:
|
||||
echo "❌ Smoke test failed!"
|
||||
exit 1
|
||||
fi
|
||||
echo "✅ Deployment verified"
|
||||
echo "✅ Smoke test passed — v${{ steps.version.outputs.version }} is live"
|
||||
|
||||
# ── Step 8: Rollback hint ────────────────
|
||||
# On any failure, prints the previous deploy tag for quick manual rollback.
|
||||
# Why: reduces MTTR (mean time to recovery) by providing the exact
|
||||
# git tag to roll back to without needing to look it up manually.
|
||||
- name: Rollback hint
|
||||
# ═══════════════════════════════════════════════════
|
||||
# Step 10: Deployment Summary
|
||||
# ═══════════════════════════════════════════════════
|
||||
- name: Deployment Summary
|
||||
if: always()
|
||||
run: |
|
||||
TRIGGER="${{ github.event_name == 'workflow_run' && 'Auto (CI success)' || 'Manual (workflow_dispatch)' }}"
|
||||
VERSION_BUMP="${{ github.event_name == 'workflow_dispatch' && inputs.version_bump || 'patch (auto)' }}"
|
||||
echo ""
|
||||
echo "═══════════════════════════════════════"
|
||||
echo " 📦 Deploy Summary"
|
||||
echo "═══════════════════════════════════════"
|
||||
echo " Version: v${{ steps.version.outputs.version }}"
|
||||
echo " Git ref: ${{ github.event_name == 'workflow_dispatch' && inputs.git_ref || 'main' }}"
|
||||
echo " Main bump: ${{ steps.version.outputs.mutated_main }}"
|
||||
echo " Service: ${{ github.event_name == 'workflow_dispatch' && inputs.service || 'all' }}"
|
||||
echo " Trigger: ${TRIGGER}"
|
||||
echo " Bump type: ${VERSION_BUMP}"
|
||||
echo " Actor: @${{ gitea.actor }}"
|
||||
echo " Status: ${{ job.status }}"
|
||||
echo "═══════════════════════════════════════"
|
||||
|
||||
# ═══════════════════════════════════════════════════
|
||||
# Step 11: Failure → Reviewer Handoff
|
||||
#
|
||||
# On failure: DevOps (Architekt) analyses the log,
|
||||
# notifies Reviewer (Code-Fixer) with the exact error.
|
||||
# This output provides a ready-to-copy message.
|
||||
# ═══════════════════════════════════════════════════
|
||||
- name: 🔴 Failure — Reviewer Handoff
|
||||
if: failure()
|
||||
run: |
|
||||
echo ""
|
||||
echo "🔙 ─── Rollback Instructions ─── 🔙"
|
||||
echo ""
|
||||
echo " # 1. Checkout previous version:"
|
||||
echo " git checkout tags/\$(git describe --tags --abbrev=0 2>/dev/null || echo 'unknown')"
|
||||
echo ""
|
||||
echo " # 2. Redeploy:"
|
||||
echo " cd /opt/openclaw/data/openclaw/workspace/nexus"
|
||||
echo " docker compose up -d --force-recreate"
|
||||
echo ""
|
||||
echo " # 3. Or trigger rollback via Gitea:"
|
||||
echo " Trigger 'Deploy to Production' workflow with the previous tag"
|
||||
echo ""
|
||||
echo "┌─────────────────────────────────────────────────────────────┐"
|
||||
echo "│ 🔴 DEPLOY FAILED — Reviewer muss fixen │"
|
||||
echo "├─────────────────────────────────────────────────────────────┤"
|
||||
echo "│ │"
|
||||
echo "│ Version: v${{ steps.version.outputs.version }}"
|
||||
echo "│ Job: ${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_id }}"
|
||||
echo "│ │"
|
||||
echo "│ → DevOps (Architekt) analysiert den Fehler │"
|
||||
echo "│ → Reviewer (Code-Fixer) behebt das Problem │"
|
||||
echo "│ → DevOps verifiziert mit neuem Deploy │"
|
||||
echo "│ │"
|
||||
echo "│ Rollback: Trigger 'Rollback to Previous Version' │"
|
||||
echo "│ workflow manuell in Gitea Actions. │"
|
||||
echo "│ │"
|
||||
echo "└─────────────────────────────────────────────────────────────┘"
|
||||
|
||||
Reference in New Issue
Block a user