mirror of
https://github.com/Alkatrazz24/Funk-lab.git
synced 2026-07-08 11:04:43 +02:00
ci(stt): images taguées par SHA + bump auto du manifest (fin du :latest) (#9)
La CI build l'image en sha-<commit> et, sur main, met à jour k8s/apps/stt/deployment.yaml avec ce tag (commit [skip ci]). ArgoCD redéploie alors une image immuable et déterministe — fini les races de timing et les 'kubectl rollout restart' manuels. permissions: contents write (pour le bump). :latest gardé en parallèle sur main (fallback). Claude-Session: https://claude.ai/code/session_013FmcxGsyXZXogiAHQLjnZT Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
815beaf37c
commit
70499b7d84
4 changed files with 36 additions and 17 deletions
42
.github/workflows/build-stt-server.yml
vendored
42
.github/workflows/build-stt-server.yml
vendored
|
|
@ -1,6 +1,7 @@
|
|||
name: build-stt-server
|
||||
|
||||
# Construit et pousse l'image du STT-server vers ghcr.io quand stt/server/ change.
|
||||
# Construit l'image du STT-server, la tague par SHA de commit, et (sur main) met à jour
|
||||
# le manifest k8s avec ce tag → ArgoCD déploie une image immuable et déterministe.
|
||||
on:
|
||||
push:
|
||||
branches: ["main", "claude/**"]
|
||||
|
|
@ -16,11 +17,22 @@ jobs:
|
|||
build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
contents: write # pour committer le bump du manifest sur main
|
||||
packages: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Calcule le tag (SHA court) + la liste des tags
|
||||
id: vars
|
||||
run: |
|
||||
TAG="sha-$(git rev-parse --short=7 HEAD)"
|
||||
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
||||
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
|
||||
echo "tags=${IMAGE}:${TAG},${IMAGE}:latest" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "tags=${IMAGE}:${TAG}" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Log in to GHCR
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
|
|
@ -28,19 +40,23 @@ jobs:
|
|||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Metadata (tags)
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.IMAGE }}
|
||||
tags: |
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
type=sha,format=short
|
||||
|
||||
- name: Build & push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: stt/server
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
tags: ${{ steps.vars.outputs.tags }}
|
||||
|
||||
- name: Met à jour le manifest avec le tag SHA (main uniquement)
|
||||
if: github.ref == 'refs/heads/main'
|
||||
run: |
|
||||
sed -i "s|image: ${IMAGE}:.*|image: ${IMAGE}:${{ steps.vars.outputs.tag }}|" \
|
||||
k8s/apps/stt/deployment.yaml
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add k8s/apps/stt/deployment.yaml
|
||||
if ! git diff --staged --quiet; then
|
||||
git commit -m "ci(stt): image → ${{ steps.vars.outputs.tag }} [skip ci]"
|
||||
git pull --rebase origin main
|
||||
git push
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ spec:
|
|||
type: RuntimeDefault
|
||||
containers:
|
||||
- name: stt-server
|
||||
# Tag géré par la CI (build-stt-server.yml) : bumpé en sha-<commit> à chaque build main.
|
||||
image: ghcr.io/alkatrazz24/funk-stt-server:latest
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
|
|
|
|||
|
|
@ -36,10 +36,11 @@ Prérequis voix : micro, Piper + voix dans `~/.local/share/piper/`, `aplay` (als
|
|||
|
||||
## Serveur — déploiement (cluster)
|
||||
|
||||
1. **Image** : poussée sur `ghcr.io/alkatrazz24/funk-stt-server` par le workflow
|
||||
`.github/workflows/build-stt-server.yml` (sur push touchant `stt/server/`).
|
||||
1. **Image** : le workflow `.github/workflows/build-stt-server.yml` (push touchant `stt/server/`)
|
||||
build l'image taguée **`sha-<commit>`** et, sur `main`, **met à jour le manifest** avec ce
|
||||
tag (commit `ci(stt): image → …`). Plus de `:latest` ni de `rollout restart` manuel.
|
||||
2. **ArgoCD** : `k8s/apps-of-apps/apps/stt.yaml` → déploie `k8s/apps/stt/` **depuis `main`**.
|
||||
Tant que ce n'est pas mergé sur `main`, le cluster ne le prend pas.
|
||||
Le bump du tag par la CI suffit à déclencher un nouveau pod (déploiement déterministe).
|
||||
3. Le serveur joint LiteLLM (s01, hors cluster) en **IP directe** `192.168.10.1:4000`
|
||||
(même pattern qu'open-webui — pas de Service/Endpoints intermédiaire).
|
||||
4. **Image privée** : le Deployment référence un `imagePullSecret` `ghcr-pull`.
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ curl -s localhost:8000/v1/ask -H 'content-type: application/json' -d '{"text":"b
|
|||
|
||||
## Déploiement
|
||||
|
||||
- Image construite/poussée par `.github/workflows/build-stt-server.yml` → `ghcr.io/alkatrazz24/funk-stt-server`.
|
||||
- Image construite/poussée par `.github/workflows/build-stt-server.yml`, taguée `sha-<commit>` ;
|
||||
sur `main` la CI bumpe le manifest avec ce tag → ArgoCD redéploie tout seul (déterministe).
|
||||
- Manifests : `k8s/apps/stt/` ; Application ArgoCD : `k8s/apps-of-apps/apps/stt.yaml` (depuis `main`).
|
||||
- Accès LiteLLM (hors cluster) : IP directe `192.168.10.1:4000` (même pattern qu'open-webui).
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue