From b006caa3dfeaad9dc14d018ceb5ffc2f9f8d9ffa Mon Sep 17 00:00:00 2001 From: Manus AI Date: Tue, 18 Aug 2026 08:30:37 +0000 Subject: [PATCH] =?UTF-8?q?ci(ops):=20ajouter=20runner=20Gitea=20recette?= =?UTF-8?q?=20versionn=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ops/README.md | 2 ++ ops/gitea-act-runner-config.yaml | 11 +++++++++++ ops/gitea-act-runner.service | 16 ++++++++++++++++ ops/install-gitea-act-runner.sh | 28 ++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+) create mode 100644 ops/gitea-act-runner-config.yaml create mode 100644 ops/gitea-act-runner.service create mode 100644 ops/install-gitea-act-runner.sh diff --git a/ops/README.md b/ops/README.md index f0ef587..4f4c5c3 100644 --- a/ops/README.md +++ b/ops/README.md @@ -4,6 +4,8 @@ Le script `healthcheck-apps.sh` est exécuté par le timer systemd toutes les ci Le dernier rapport est écrit dans `/var/lib/manus-apps-health/latest.txt`. Les anomalies sont aussi consignées dans le journal système avec le tag `manus-apps-health`. +Le runner de recette est installé par `install-gitea-act-runner.sh`. Il s’enregistre une fois auprès de Gitea avec un jeton éphémère, puis exécute les workflows dans un conteneur Node 22 isolé sur le réseau Docker `web`. + Après mise à jour Git, installer ou actualiser le service avec : ```bash diff --git a/ops/gitea-act-runner-config.yaml b/ops/gitea-act-runner-config.yaml new file mode 100644 index 0000000..7e84266 --- /dev/null +++ b/ops/gitea-act-runner-config.yaml @@ -0,0 +1,11 @@ +log: + level: info + +runner: + capacity: 1 + envs: + DOCKER_HOST: unix:///var/run/docker.sock + +container: + network: web + options: --pull=always diff --git a/ops/gitea-act-runner.service b/ops/gitea-act-runner.service new file mode 100644 index 0000000..64738f7 --- /dev/null +++ b/ops/gitea-act-runner.service @@ -0,0 +1,16 @@ +[Unit] +Description=Runner Gitea Actions de recette +After=docker.service network-online.target +Requires=docker.service +Wants=network-online.target + +[Service] +Type=simple +User=root +Environment=DOCKER_HOST=unix:///var/run/docker.sock +ExecStart=/usr/local/bin/act_runner daemon --config /opt/manus-deploy/gitea-runner/config.yaml +Restart=always +RestartSec=10s + +[Install] +WantedBy=multi-user.target diff --git a/ops/install-gitea-act-runner.sh b/ops/install-gitea-act-runner.sh new file mode 100644 index 0000000..d7cea5f --- /dev/null +++ b/ops/install-gitea-act-runner.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# Installe et enregistre le runner de recette depuis les fichiers versionnés du dashboard. +set -Eeuo pipefail + +readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +readonly RUNNER_DIR="/opt/manus-deploy/gitea-runner" +readonly GITEA_CONTAINER="gitea" +readonly GITEA_URL="https://git.recette.santinova-soft.org" +readonly RUNNER_NAME="recette-docker-runner" +readonly RUNNER_LABELS="ubuntu-latest:docker://node:22-bookworm" + +install -d -m 0750 "${RUNNER_DIR}" +install -m 0640 "${SCRIPT_DIR}/gitea-act-runner-config.yaml" "${RUNNER_DIR}/config.yaml" +install -D -m 0644 "${SCRIPT_DIR}/gitea-act-runner.service" /etc/systemd/system/gitea-act-runner.service + +if [[ ! -f "${RUNNER_DIR}/.runner" ]]; then + token="$(docker exec -u git "${GITEA_CONTAINER}" gitea actions generate-runner-token)" + /usr/local/bin/act_runner register --no-interactive \ + --instance "${GITEA_URL}" \ + --token "${token}" \ + --name "${RUNNER_NAME}" \ + --labels "${RUNNER_LABELS}" \ + --config "${RUNNER_DIR}/config.yaml" +fi + +systemctl daemon-reload +systemctl enable --now gitea-act-runner.service +systemctl is-active gitea-act-runner.service