ci: consolidate Nexus deployment and provenance
CI - Build & Test / Backend (.NET) (push) Successful in 48s
CI - Build & Test / Frontend (Vue/TS) (push) Successful in 55s
CI - Build & Test / Security Check (push) Successful in 3s
CI - Build & Test / Deploy Nexus (push) Has been skipped

This commit is contained in:
2026-07-09 23:46:46 +02:00
parent aaec3eb4ed
commit a104acf160
6 changed files with 44 additions and 5 deletions
+18
View File
@@ -53,6 +53,7 @@ if ! echo "$VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$'; then
exit 1 exit 1
fi fi
GIT_SHA="$(git rev-parse HEAD 2>/dev/null || echo unknown)"
GIT_REF="$(git rev-parse --short HEAD 2>/dev/null || echo unknown)" GIT_REF="$(git rev-parse --short HEAD 2>/dev/null || echo unknown)"
echo "Deploying Nexus v$VERSION from $GIT_REF" echo "Deploying Nexus v$VERSION from $GIT_REF"
@@ -68,6 +69,8 @@ BOOTSTRAP_OWNER_EMAIL=vmbao62@hotmail.de
OPENCLAW_BASE_URL=http://host.docker.internal:18789 OPENCLAW_BASE_URL=http://host.docker.internal:18789
OPENCLAW_GATEWAY_TOKEN=${ENV_OPENCLAW_TOKEN:-} OPENCLAW_GATEWAY_TOKEN=${ENV_OPENCLAW_TOKEN:-}
OPENCLAW_GATEWAY_PASSWORD= OPENCLAW_GATEWAY_PASSWORD=
NEXUS_VERSION=${VERSION}
NEXUS_GIT_SHA=${GIT_SHA}
EOF_ENV EOF_ENV
echo "Syncing source to deploy path: $DEPLOY_PATH" echo "Syncing source to deploy path: $DEPLOY_PATH"
@@ -128,6 +131,21 @@ docker run --rm \
docker:cli \ docker:cli \
sh /deploy.sh < "$ENV_TMPFILE" sh /deploy.sh < "$ENV_TMPFILE"
echo "Verifying image provenance"
for container in nexus-api-1 nexus-web-1; do
revision="$(docker inspect --format '{{ index .Config.Labels "org.opencontainers.image.revision" }}' "$container")"
version="$(docker inspect --format '{{ index .Config.Labels "org.opencontainers.image.version" }}' "$container")"
if [ "$revision" != "$GIT_SHA" ]; then
echo "Image revision mismatch for $container: expected $GIT_SHA, got $revision" >&2
exit 1
fi
if [ "$version" != "$VERSION" ]; then
echo "Image version mismatch for $container: expected $VERSION, got $version" >&2
exit 1
fi
echo "$container provenance verified: v$version $revision"
done
echo "Checking live health" echo "Checking live health"
retry=0 retry=0
while [ "$retry" -lt 6 ]; do while [ "$retry" -lt 6 ]; do
+1 -1
View File
@@ -33,7 +33,7 @@ on:
host_backup_path: host_backup_path:
description: 'Host path for backup (only if keep_on_host is true)' description: 'Host path for backup (only if keep_on_host is true)'
required: false required: false
default: '/home/projekte_bao/openclaw/backups' default: '/home/projekte_bao/backups/nexus'
type: string type: string
# Optional: uncomment to enable nightly automatic backups # Optional: uncomment to enable nightly automatic backups
+7 -4
View File
@@ -8,9 +8,12 @@ concurrency:
on: on:
push: push:
branches: [main] branches:
- main
- 'codex/**'
pull_request: pull_request:
branches: [main] branches: [main]
workflow_dispatch:
jobs: jobs:
# ─── Backend ─────────────────────────────────── # ─── Backend ───────────────────────────────────
@@ -73,7 +76,7 @@ jobs:
security: security:
name: Security Check name: Security Check
runs-on: linux runs-on: linux
if: github.ref == 'refs/heads/main' if: gitea.ref == 'refs/heads/main' || startsWith(gitea.ref, 'refs/heads/codex/')
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -106,8 +109,8 @@ jobs:
group: deploy-production group: deploy-production
cancel-in-progress: false cancel-in-progress: false
if: | if: |
github.event_name == 'push' && gitea.event_name == 'push' &&
github.ref == 'refs/heads/main' gitea.ref == 'refs/heads/main'
env: env:
DEPLOY_PATH: /home/projekte_bao/openclaw/data/openclaw/workspace/nexus DEPLOY_PATH: /home/projekte_bao/openclaw/data/openclaw/workspace/nexus
ENV_POSTGRES_PASSWORD: ${{ secrets.ENV_POSTGRES_PASSWORD }} ENV_POSTGRES_PASSWORD: ${{ secrets.ENV_POSTGRES_PASSWORD }}
+6
View File
@@ -6,6 +6,12 @@ COPY . .
RUN dotnet publish -c Release -o /app/publish RUN dotnet publish -c Release -o /app/publish
FROM mcr.microsoft.com/dotnet/aspnet:10.0-alpine FROM mcr.microsoft.com/dotnet/aspnet:10.0-alpine
ARG NEXUS_VERSION=dev
ARG NEXUS_GIT_SHA=unknown
LABEL org.opencontainers.image.title="Nexus API" \
org.opencontainers.image.source="https://git.noveria.net/bao/nexus" \
org.opencontainers.image.version="${NEXUS_VERSION}" \
org.opencontainers.image.revision="${NEXUS_GIT_SHA}"
WORKDIR /app WORKDIR /app
COPY --from=build /app/publish . COPY --from=build /app/publish .
RUN apk add --no-cache curl RUN apk add --no-cache curl
+6
View File
@@ -31,6 +31,9 @@ services:
api: api:
build: build:
context: ./backend context: ./backend
args:
NEXUS_VERSION: ${NEXUS_VERSION:-dev}
NEXUS_GIT_SHA: ${NEXUS_GIT_SHA:-unknown}
restart: always restart: always
deploy: deploy:
resources: resources:
@@ -83,6 +86,9 @@ services:
web: web:
build: build:
context: ./frontend context: ./frontend
args:
NEXUS_VERSION: ${NEXUS_VERSION:-dev}
NEXUS_GIT_SHA: ${NEXUS_GIT_SHA:-unknown}
restart: always restart: always
deploy: deploy:
resources: resources:
+6
View File
@@ -7,6 +7,12 @@ COPY . .
RUN pnpm build RUN pnpm build
FROM nginx:1.27-alpine FROM nginx:1.27-alpine
ARG NEXUS_VERSION=dev
ARG NEXUS_GIT_SHA=unknown
LABEL org.opencontainers.image.title="Nexus Web" \
org.opencontainers.image.source="https://git.noveria.net/bao/nexus" \
org.opencontainers.image.version="${NEXUS_VERSION}" \
org.opencontainers.image.revision="${NEXUS_GIT_SHA}"
COPY nginx.conf /etc/nginx/conf.d/default.conf COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80 EXPOSE 80