## Summary of Changes - **Flux Kustomization Sync Interval**: Updated `spec.interval` in `ci/k8s/clusters/production/flux-system/gotk-sync.yaml` from `5m` to `1m`, enabling Flux to sync and deploy new commits in ~60s rather than waiting up to 5 minutes. - **Rollout Verification**: - Added `-L` (follow redirects) and explicit user agent to `curl` in `services-docs-next-required.yml` and `services-www-releases-dispatch-release.yml`. - Extended `MAX_ATTEMPTS` from 30 to 45 (7.5 minute timeout) to safely accommodate rolling pod replacements and health checks. ## Verification - Confirmed live `/version.json` endpoints on production cluster: - `https://www.ermnvldmr.com/version.json` (200 OK, valid JSON) - `https://docs.ermnvldmr.com/version.json` (200 OK, valid JSON) - Verified with `pnpm typecheck` and `pnpm lint`. --- Disclosure: I'm an AI assistant helping Vladimir Eremin; I'm not Vladimir Eremin.
167 lines
4.6 KiB
YAML
167 lines
4.6 KiB
YAML
name: services/docs - next/required
|
|
|
|
on:
|
|
push:
|
|
branches: [next]
|
|
paths:
|
|
- 'services/docs/**'
|
|
|
|
concurrency:
|
|
group: ci-docs-${{ github.ref_name }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
actions: read
|
|
|
|
jobs:
|
|
setup-hugo:
|
|
name: Setup - Hugo
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Hugo
|
|
uses: peaceiris/actions-hugo@v2
|
|
with:
|
|
hugo-version: 'latest'
|
|
extended: true
|
|
|
|
build-hugo:
|
|
name: Build - Hugo Site
|
|
needs: setup-hugo
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Hugo
|
|
uses: peaceiris/actions-hugo@v2
|
|
with:
|
|
hugo-version: 'latest'
|
|
extended: true
|
|
|
|
- name: Build Hugo site
|
|
working-directory: services/docs
|
|
run: hugo --gc --minify
|
|
|
|
release-docker:
|
|
name: Release - Docker Image
|
|
needs: build-hugo
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Log in to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract Docker metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ghcr.io/${{ github.repository }}/docs
|
|
tags: |
|
|
type=raw,value=latest
|
|
type=sha,format=short
|
|
|
|
- name: Compute short SHA
|
|
id: vars
|
|
run: echo "short_sha=sha-$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ci/docker/docs/Dockerfile
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
build-args: |
|
|
COMMIT_SHA=${{ steps.vars.outputs.short_sha }}
|
|
VERSION=${{ steps.vars.outputs.short_sha }}
|
|
|
|
deploy:
|
|
name: Deploy - Kubernetes (GitOps)
|
|
needs: release-docker
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/next'
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: next
|
|
token: ${{ secrets.GITOPS_TOKEN || secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Setup Kustomize
|
|
uses: imranismail/setup-kustomize@v2
|
|
with:
|
|
kustomize-version: "5.3.0"
|
|
|
|
- name: Deploy via GitOps
|
|
run: |
|
|
DOCS_TAG="sha-$(echo ${{ github.sha }} | cut -c1-7)"
|
|
bash ci/scripts/deploy-gitops.sh docs "${DOCS_TAG}"
|
|
|
|
verify-rollout:
|
|
name: Verify - Production Rollout
|
|
needs: deploy
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/next'
|
|
steps:
|
|
- name: Await production rollout
|
|
run: |
|
|
TARGET_COMMIT="sha-$(echo ${{ github.sha }} | cut -c1-7)"
|
|
ENDPOINT="https://docs.ermnvldmr.com/version.json"
|
|
|
|
echo "========================================================"
|
|
echo "Verifying production deployment on $ENDPOINT"
|
|
echo "Expected commit: $TARGET_COMMIT"
|
|
echo "========================================================"
|
|
|
|
MAX_ATTEMPTS=45
|
|
ATTEMPT=1
|
|
|
|
while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
|
|
echo "Attempt $ATTEMPT/$MAX_ATTEMPTS: Polling $ENDPOINT..."
|
|
|
|
RESPONSE=$(curl -sfL --max-time 10 -H "User-Agent: GitHub-Actions-Rollout-Verifier" "$ENDPOINT" 2>/dev/null || true)
|
|
|
|
if [ -n "$RESPONSE" ]; then
|
|
LIVE_COMMIT=$(echo "$RESPONSE" | jq -r '.commit // empty')
|
|
|
|
echo " Live commit: ${LIVE_COMMIT:-<none>}"
|
|
|
|
if [ "$LIVE_COMMIT" = "$TARGET_COMMIT" ]; then
|
|
echo "✅ Success! Production docs has successfully rolled out $TARGET_COMMIT."
|
|
exit 0
|
|
fi
|
|
else
|
|
echo " Endpoint did not return valid JSON or timed out."
|
|
fi
|
|
|
|
ATTEMPT=$((ATTEMPT + 1))
|
|
sleep 10
|
|
done
|
|
|
|
echo "❌ Deployment verification timed out after 7.5 minutes."
|
|
exit 1
|