Actualiser README.md

This commit is contained in:
2025-04-14 18:23:10 +02:00
parent 03d075219b
commit 69adfee3d3

View File

@@ -1,15 +1,20 @@
# L'action `healthchecks-ping` # L'action `build-push-image`
Cette action permet denvoyer un *ping* vers un serveur [Healthchecks.io](https://healthchecks.io) (ou un serveur compatible). Cette action permet de **construire une image conteneur**, de la taguer, de la pousser vers un registre et de notifier [Healthchecks.io](https://healthchecks.io) à chaque étape.
Elle est conçue pour être utilisée dans des workflows Gitea avec des runners auto-hébergés. Elle intègre des fonctionnalités de gestion de versions, de notifications et supporte *Docker* ou *Podman*.
--- ---
## 🔧 Utilisation ## 🔧 Utilisation
```yaml ```yaml
- name: Notify healthchecks - name: Build and push image
uses: https://gargoton.petite-maison-orange.fr/pmo-actions/healthchecks-ping@main uses: https://gargoton.petite-maison-orange.fr/pmo-actions/build-push-image@main
with:
image_name: mon-projet
image_tags: latest
check_server: https://haoma.petite-maison-orange.fr
check_uuid: x1y2z3-1234-5678-9abc-def123456789
``` ```
--- ---
@@ -17,50 +22,76 @@ Elle est conçue pour être utilisée dans des workflows Gitea avec des runners
## 📥 Paramètres ## 📥 Paramètres
| Nom | Obligatoire | Par défaut | Description | | Nom | Obligatoire | Par défaut | Description |
|------------------|-------------|------------|-----------------------------------------------------------------------------| |------------------------|-------------|-------------------------------------|-----------------------------------------------------------------------------|
| `check_server` | ✅ | | Adresse du serveur Healthchecks, incluant `https://`. | | `image_name` | ✅ | | Nom de l'image à construire |
| `check_uuid` | ✅ | | Identifiant UUID de la vérification. | | `image_tags` | ✅ | | Tags de l'image (séparés par des espaces) |
| `check_command` | ❌ | `stop` | Commande : `start`, `log`, `fail`, ou `stop`. | | `add_version_tag` | ❌ | `true` | Ajoute un tag basé sur la version (ex: `pmo-1.2.3`) |
| `check_message` | ❌ | `""` | Message transmis avec le ping (visible dans linterface Healthchecks). | | `version_tag_prefix` | ❌ | `pmo` | Préfixe du tag de version |
| `debug` | ❌ | `false` | Affiche des messages de debug détaillés si activé. | | `build_command` | ❌ | `docker` | Outil de build (`docker`/`podman`) |
| `tag_command` | ❌ | `podman` | Outil de tagging (`docker`/`podman`) |
| `registry_server` | ❌ | `niepce.petite-maison-orange.fr` | URL du registre |
| `registry_user` | ❌ | `${{ secrets.PMO_REGISTRY_USER }}` | Utilisateur du registre |
| `registry_password` | ❌ | `${{ secrets.PMO_REGISTRY_PASSWORD }}` | Mot de passe du registre |
| `version_file` | ❌ | `software_version.txt` | Fichier contenant la version |
| `check_server` | ❌ | `https://haoma.petite-maison-orange.fr` | Serveur Healthchecks (vide = désactivé) |
| `check_uuid` | ❌ | | UUID de la vérification Healthchecks |
| `debug` | ❌ | `false` | Active les logs de débogage |
--- ---
## ▶️ Exemple de workflow ## ▶️ Exemple de workflow complet
```yaml ```yaml
- name: Notify healthchecks (start) name: Build and Deploy
uses: https://gargoton.petite-maison-orange.fr/pmo-actions/healthchecks-ping@main
on: [push]
jobs:
build:
runs-on: self-hosted
steps:
- name: Build and push image
uses: https://gargoton.petite-maison-orange.fr/pmo-actions/build-push-image@main
with: with:
image_name: api-server
image_tags: "latest staging"
add_version_tag: true
version_tag_prefix: "v"
build_command: podman
registry_server: registry.example.com
registry_user: ${{ secrets.REGISTRY_USER }}
registry_password: ${{ secrets.REGISTRY_PASSWORD }}
check_server: https://hc-ping.com check_server: https://hc-ping.com
check_uuid: a1b2c3d4-1234-5678-9abc-def123456789 check_uuid: a1b2c3d4-1234-5678-9abc-def123456789
check_command: start debug: true
- name: Build my project
run: make build
- name: Notify healthchecks (stop)
uses: https://gargoton.petite-maison-orange.fr/pmo-actions/healthchecks-ping@main
with:
check_server: https://hc-ping.com
check_uuid: a1b2c3d4-1234-5678-9abc-def123456789
check_message: "Build terminé avec succès ✅"
``` ```
--- ---
## ⚙️ Comportement ## ⚙️ Comportement
- Si `check_command: fail` est utilisé, **laction échoue volontairement** (`exit 1`). ### Étapes clés
- Si `curl` échoue, laction affiche lerreur et échoue également. 1. **Notifications Healthchecks** (si activé) :
- LURL appelée par `curl` dépend de la commande : - Début de la tâche (`start`)
- `https://<check_server>/ping/<uuid>` *(commande `stop` ou vide)* - Log pendant le build (`log`)
- `https://<check_server>/ping/<uuid>/<check_command>` *(commande `start`, `log`, `fail`)* - Échec en cas d'annulation/erreur (`fail`)
- Succès final (`stop`)
2. **Gestion des versions** :
- Récupère la version depuis `software_version.txt`
- Ajoute un tag versionné (ex: `pmo-1.0.0`)
3. **Construction de l'image** :
- Installation auto de Podman si besoin
- Build avec `docker`/`podman`
4. **Push vers le registre** :
- Authentification automatique
- Push multi-tags
--- ---
## 🧡 À propos ## 🧡 À propos
Cette action fait partie des actions de la **Petite Maison Orange**. Cette action fait partie des actions de la **Petite Maison Orange**.
Toutes les actions sont disponibles ici :
👉 [https://gargoton.petite-maison-orange.fr/pmo-actions/](https://gargoton.petite-maison-orange.fr/pmo-actions/) 👉 [https://gargoton.petite-maison-orange.fr/pmo-actions/](https://gargoton.petite-maison-orange.fr/pmo-actions/)