Add Gitea Actions CI, ArgoCD Application, and Gitea Packages wiring
- .gitea/workflows/ci.yml: build → seo:lint → e2e → image build/push → bump k8s image tag and commit back (paths-ignore + [skip ci] guard) - argocd/bcs-website-application.yaml: ArgoCD App (internal Gitea repoURL, k8s path) - k8s: image → Gitea Packages path; kustomization images newTag stanza - ADR-0007 (Gitea Actions + Packages), supersedes GHCR/GitHub bits of ADR-0001 - Reconcile gitops-deployment-strategy.md to Gitea Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
cd91c4b97c
commit
3dab3bc9fb
8 files changed
+193
-23
No files matched your search
@@ -0,0 +1,85 @@
|
||||
# BlueCap Strategies CI — Gitea Actions (ADR-0007)
|
||||
#
|
||||
# Pipeline: install → build (typecheck) → seo:lint → e2e → build & push image to Gitea Packages
|
||||
# → bump the image tag in k8s/ and commit back to main. ArgoCD then reconciles k3s.
|
||||
#
|
||||
# PREREQUISITES (homelab, verify before the first run — see docs/gitops-deployment-strategy.md):
|
||||
# 1. Docker must be usable from the job container. The runner mounts /var/run/docker.sock; if
|
||||
# jobs can't see it, enable socket passthrough in act_runner config or switch this to kaniko.
|
||||
# 2. The RUNNER HOST's dockerd must treat 10.66.15.22:3000 as an insecure (HTTP) registry
|
||||
# ("insecure-registries": ["10.66.15.22:3000"] in /etc/docker/daemon.json).
|
||||
# 3. K3S must trust the same HTTP registry — add a registries.yaml entry (k3s_registry_mirrors)
|
||||
# for 10.66.15.22:3000, then restart k3s, or the pods can't pull the image.
|
||||
# 4. The Gitea container package should be PUBLIC (simplest). If PRIVATE, add an imagePullSecret
|
||||
# (see k8s/deployment.yaml) and grant the run token package:write.
|
||||
# 5. secrets.GITEA_TOKEN (auto-injected per run) needs write access to this repo (tag-bump commit)
|
||||
# and the package registry.
|
||||
|
||||
name: CI
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
# Don't re-trigger on the CI tag-bump commit (touches k8s/) or docs-only changes.
|
||||
paths-ignore:
|
||||
- 'k8s/**'
|
||||
- 'docs/**'
|
||||
- 'planning/**'
|
||||
- '**/*.md'
|
||||
|
||||
env:
|
||||
IMAGE: 10.66.15.22:3000/bmr_bluecap/bcs-website
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node 22
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build (typecheck + astro build)
|
||||
run: npm run build
|
||||
|
||||
- name: SEO lint
|
||||
run: npm run seo:lint
|
||||
|
||||
- name: End-to-end tests
|
||||
run: |
|
||||
npx playwright install --with-deps chromium
|
||||
npm run test:e2e
|
||||
|
||||
- name: Compute image tag
|
||||
id: tag
|
||||
run: echo "sha=$(echo ${{ github.sha }} | cut -c1-12)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Ensure docker + kustomize are available
|
||||
run: |
|
||||
command -v docker >/dev/null 2>&1 || { apt-get update && apt-get install -y docker.io; }
|
||||
command -v kustomize >/dev/null 2>&1 || \
|
||||
curl -sSL "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv5.4.3/kustomize_v5.4.3_linux_amd64.tar.gz" \
|
||||
| tar xz -C /usr/local/bin
|
||||
|
||||
- name: Build & push image to Gitea Packages
|
||||
run: |
|
||||
echo "${{ secrets.GITEA_TOKEN }}" | docker login 10.66.15.22:3000 -u "${{ github.actor }}" --password-stdin
|
||||
docker build -t "$IMAGE:${{ steps.tag.outputs.sha }}" -t "$IMAGE:latest" .
|
||||
docker push "$IMAGE:${{ steps.tag.outputs.sha }}"
|
||||
docker push "$IMAGE:latest"
|
||||
|
||||
- name: Bump k8s image tag and commit back
|
||||
run: |
|
||||
git config user.name "gitea-actions[bot]"
|
||||
git config user.email "gitea-actions@bmr_bluecap"
|
||||
(cd k8s && kustomize edit set image "$IMAGE=$IMAGE:${{ steps.tag.outputs.sha }}")
|
||||
git add k8s/kustomization.yaml
|
||||
git diff --cached --quiet && { echo "no image change"; exit 0; }
|
||||
git commit -m "ci: deploy ${{ steps.tag.outputs.sha }} [skip ci]"
|
||||
git remote set-url origin "http://gitea-actions:${{ secrets.GITEA_TOKEN }}@10.66.15.22:3000/bmr_bluecap/bcs-website.git"
|
||||
git push origin HEAD:main
|
||||
Reference in new issue
Block a user