diff --git a/.github/workflows/build-stt-server.yml b/.github/workflows/build-stt-server.yml index 985665c..e0dca87 100644 --- a/.github/workflows/build-stt-server.yml +++ b/.github/workflows/build-stt-server.yml @@ -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 diff --git a/k8s/apps/stt/deployment.yaml b/k8s/apps/stt/deployment.yaml index 5c1d15d..2dae854 100644 --- a/k8s/apps/stt/deployment.yaml +++ b/k8s/apps/stt/deployment.yaml @@ -25,6 +25,7 @@ spec: type: RuntimeDefault containers: - name: stt-server + # Tag géré par la CI (build-stt-server.yml) : bumpé en sha- à chaque build main. image: ghcr.io/alkatrazz24/funk-stt-server:latest securityContext: allowPrivilegeEscalation: false diff --git a/stt/README.md b/stt/README.md index 7cff5ad..5369915 100644 --- a/stt/README.md +++ b/stt/README.md @@ -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-`** 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`. diff --git a/stt/server/README.md b/stt/server/README.md index 5bb2054..68752b9 100644 --- a/stt/server/README.md +++ b/stt/server/README.md @@ -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-` ; + 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).