Compare commits

..

31 Commits

Author SHA1 Message Date
e7ef7e9439 ci(build): enable SSH forwarding for docker buildx (--ssh default) and allow buildkit entitlements 2025-09-10 12:51:56 +02:00
667be5fa78 ci: add known_hosts and force SSH for git.4nkweb.com 2025-09-10 12:49:14 +02:00
22ace2a948 ci(log): write per-image logs to log/ci/ and summary.txt 2025-09-10 12:46:20 +02:00
b926417227 ci/docs: rely solely on branch name as DOCKER_TAG; remove tag triggers 2025-09-10 12:39:36 +02:00
9f05c31e0d ci: branch name equals DOCKER_TAG; wildcard branch trigger; updated fallback 2025-09-10 12:36:28 +02:00
8ba17169be docs: documentation complète (architecture, CI, submodules, docker, release, dev, scripts, FAQ) 2025-09-10 12:29:45 +02:00
f9123097ef ci: replace sync_submodules step with init/update built-in 2025-09-10 12:23:54 +02:00
1076e43650 ci: support commit message override (ci: docker_tag=VALUE) with fallbacks 2025-09-10 12:20:30 +02:00
eec148c71f ci: pass DOCKER_TAG as explicit arg to build_and_push.sh (mandatory) 2025-09-10 12:18:50 +02:00
d0e0d06bb4 ci(build): require DOCKER_TAG env var (mandatory) 2025-09-10 12:17:27 +02:00
f9344e49cc ci(tag): set DOCKER_TAG=dev-test-2 in .ci/tag.env
Some checks are pending
dev-test / build-and-push (push) Waiting to run
2025-09-10 12:15:28 +02:00
92b6c2580e ci: support branch-based trigger with .ci/tag.env and helper script 2025-09-10 12:13:03 +02:00
1a846b63f1 refactor(ci): structure tag.sh into functions and improve readability 2025-09-10 12:05:32 +02:00
3cd729bb71 feat(ci): tag all repos (root + submodules) with optional tag (default dev-test) 2025-09-10 12:04:51 +02:00
bfd833cc5b chore(ci): make tag.sh accept optional tag name (default dev-test) 2025-09-10 12:03:16 +02:00
69bc6f984e chore: update .gitmodules (id_verif->dev), minor script/doc updates 2025-09-10 11:59:57 +02:00
cb55b82918 chore: deduplicate .gitmodules and normalize paths 2025-09-10 11:57:54 +02:00
49749ed795 chore: normalise submodules paths; add CI dev-test and scripts; bump version v2025.09.1
Some checks are pending
dev-test / build-and-push (push) Waiting to run
2025-09-10 11:49:43 +02:00
root
b7308bec80 chore(submodule): update 4NK_node pointer after compose changes 2025-09-09 16:39:47 +02:00
root
dfe2135720 chore: mise à jour des fichiers et ajout de 4NK_IA 2025-09-09 01:27:27 +02:00
root
179c4cd504 feat(git): ajout du sous-module lecoffre-front en branche dev 2025-09-08 22:56:59 +02:00
root
3abab9c63b chore(git): ajout des submodules selon repos.csv et configuration des branches 2025-09-08 21:17:06 +02:00
Debian
e27867dd43 Update: Documentation et configuration - Ajout de l'état des services (etat_services.md) - Mise à jour du README et .gitignore - Mise à jour de repos.csv - Nettoyage de la documentation obsolète 2025-09-03 22:26:25 +00:00
Debian
02c470e3e0 feat: Analyse finale de la documentation et plan de nettoyage complet 2025-08-29 16:28:08 +00:00
Debian
17c4fccbdf docs: Plan de nettoyage de la documentation et corrections critiques
- Ajout du plan de nettoyage de la documentation
- Suppression du fichier MIGRATION.md incorrect de sdk_client
- Correction de l'API.md de sdk_common (suppression des APIs Bitcoin Core)
- Correction du USAGE.md de sdk_common (suppression des références WASM/npm)
- Mise à jour des INDEX.md pour refléter l'état actuel
- Création d'une documentation complète pour sdk_signer
2025-08-29 15:54:35 +00:00
Debian
fa87597d15 docs: Mise à jour complète de la documentation
- Ajout du README.md principal avec architecture et guide d'utilisation
- Mise à jour de docs/modules.md avec les nouveaux scripts de gestion
- Documentation de la migration WASM et de l'état actuel des projets
- Guides d'installation et de développement pour tous les composants
2025-08-29 15:44:48 +00:00
Debian
9b9f238ab0 feat: Documentation des résultats de compilation et script d'environnement
- Ajout de COMPILATION_RESULTS.md avec le statut complet de tous les projets
- Ajout de setup_dev_env.sh pour la configuration de l'environnement de développement
- Suppression de install.sh (remplacé par setup_dev_env.sh)
- Documentation de la migration WASM vers flate2 et des solutions temporaires
2025-08-29 15:39:18 +00:00
Debian
d00e281a2a add install 2025-08-29 13:30:53 +00:00
Debian
3d596f8d19 add install 2025-08-28 12:21:05 +00:00
Debian
cfa9829d45 add install 2025-08-28 12:16:27 +00:00
Debian
1c54725cad [skip ci] chore(release): v2025.08.1 2025-08-28 12:12:02 +00:00
45 changed files with 727 additions and 86 deletions

1
.ci/tag.env Normal file
View File

@ -0,0 +1 @@
DOCKER_TAG=dev-test-2

View File

@ -0,0 +1,44 @@
name: dev-test
on:
push:
tags:
- dev-test
branches:
- 'dev-test*'
paths:
- '.ci/tag.env'
jobs:
build-and-push:
runs-on: docker
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Gitea Registry
uses: docker/login-action@v3
with:
registry: git.4nkweb.com
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Sync submodules branches
run: |
bash scripts/sync_submodules.sh
- name: Build and push images
env:
REGISTRY: git.4nkweb.com
run: |
COMMIT_MSG=$(git log -1 --pretty=%B)
FROM_COMMIT=$(printf "%s" "$COMMIT_MSG" | sed -n 's/.*ci:[[:space:]]*docker_tag=\([^ ][^\n]*\).*/\1/p' | head -n1)
if [ -n "$FROM_COMMIT" ]; then
DOCKER_TAG="$FROM_COMMIT"
elif [ -f .ci/tag.env ]; then
# shellcheck disable=SC1091
. .ci/tag.env
else
DOCKER_TAG="${GITHUB_REF_NAME:-dev-test}"
fi
bash scripts/build_and_push.sh "$DOCKER_TAG"

42
.gitea/workflows/dev.yml Normal file
View File

@ -0,0 +1,42 @@
name: dev
on:
push:
branches:
- '*'
jobs:
build-and-push:
runs-on: docker
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Set up SSH agent
uses: webfactory/ssh-agent@v0.9.1
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Trust Gitea host and force SSH for git.4nkweb.com
run: |
ssh-keyscan -H git.4nkweb.com >> ~/.ssh/known_hosts
git config --global url.ssh://git@git.4nkweb.com/.insteadOf https://git.4nkweb.com/
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host
- name: Login to Gitea Registry
uses: docker/login-action@v3
with:
registry: git.4nkweb.com
username: ${{ secrets.USER }}
password: ${{ secrets.TOKEN }}
- name: Init submodules (ensure up-to-date)
run: |
git submodule sync --recursive
git submodule update --init --recursive
- name: Build and push images
env:
REGISTRY: git.4nkweb.com
run: |
DOCKER_TAG=$(git rev-parse --abbrev-ref HEAD)
bash scripts/build_and_push.sh "$DOCKER_TAG"

2
.gitignore vendored
View File

@ -10,3 +10,5 @@ sdk_relay/
sdk_signer/
sdk_signer_client/
sdk_storage/
blindbit-oracle/
sp-client/

68
.gitmodules vendored Normal file
View File

@ -0,0 +1,68 @@
[submodule "bitcoin-core"]
path = modules/bitcoin-core
url = https://github.com/bitcoin/bitcoin.git
branch = master
[submodule "blindbit-oracle"]
path = modules/blindbit-oracle
url = https://github.com/setavenger/blindbit-oracle
branch = master
[submodule "sp-client"]
path = modules/sp-client
url = https://github.com/Sosthene00/sp-client.git
branch = dev
[submodule "sdk_common"]
path = modules/sdk_common
url = https://git.4nkweb.com/4nk/sdk_common.git
branch = dev
[submodule "sdk_client"]
path = modules/sdk_client
url = https://git.4nkweb.com/4nk/sdk_client.git
branch = dev
[submodule "sdk_relay"]
path = modules/sdk_relay
url = https://git.4nkweb.com/4nk/sdk_relay.git
branch = dev
[submodule "sdk_storage"]
path = modules/sdk_storage
url = https://git.4nkweb.com/4nk/sdk_storage.git
branch = dev
[submodule "sdk-signer-client"]
path = modules/sdk-signer-client
url = https://git.4nkweb.com/4nk/sdk-signer-client.git
branch = dev
[submodule "ihm_client"]
path = modules/ihm_client
url = https://git.4nkweb.com/4nk/ihm_client.git
branch = dev
[submodule "4NK_node"]
path = deploy/4NK_node
url = git@git.4nkweb.com:4nk/4NK_node.git
branch = dev
[submodule "4NK_IA"]
path = modules/4NK_IA
url = git@git.4nkweb.com:4nk/4NK_IA.git
branch = dev
[submodule "projects/id_verif/id_verif"]
path = projects/id_verif/id_verif
url = git@git.4nkweb.com:4nk/id_verif.git
branch = dev
[submodule "tor"]
path = modules/tor
url = https://github.com/torproject/tor.git
branch = main
[submodule "4NK_template"]
path = deploy/4NK_template
url = https://git.4nkweb.com/4nk/4NK_template.git
branch = main
[submodule "4NK_wallet"]
path = projects/4NK_wallet/4NK_wallet
url = https://git.4nkweb.com/4nk/4NK_wallet.git
branch = main
[submodule "lecoffre-front"]
path = projects/lecoffre/lecoffre-front
url = https://git.4nkweb.com/4nk/lecoffre-front.git
branch = dev
[submodule "lecoffre-back-mini"]
path = projects/lecoffre/lecoffre-back-mini
url = https://git.4nkweb.com/4nk/lecoffre-back-mini.git
branch = dev

10
CHANGELOG.md Normal file
View File

@ -0,0 +1,10 @@
# Changelog - 4NK_dev
## [v2025.09.1] - 2025-09-10
- Normalisation des chemins des submodules (modules/, deploy/, projects/)
- Ajout CI dev-test (workflow Gitea) + scripts build/push
- Scripts de synchronisation et réajout des submodules
## [v2025.08.1] - 2025-08-28
- Initialisation des modules et standardisation agents
- Repos.csv + update_repos.sh

116
README.md Normal file
View File

@ -0,0 +1,116 @@
# 4NK Development Environment
Ce dépôt contient l'environnement de développement complet pour l'écosystème 4NK, incluant tous les modules SDK, clients et services.
## 🏗️ Architecture
### Projets SDK (Rust)
- **sdk_common** : Bibliothèque commune avec types et utilitaires partagés
- **sdk_client** : Client SDK principal avec support WASM (migration flate2 en cours)
- **sdk_storage** : Service de stockage distribué
- **sdk_signer** : Service de signature avec interface TypeScript
### Clients (Node.js/TypeScript)
- **sdk_signer_client** : Client TypeScript pour sdk_signer
- **ihm_client** : Interface utilisateur web
### Services
- **4NK_node** : Infrastructure Docker complète avec Bitcoin, Tor, et services 4NK
- **sdk_relay** : Service de relais pour la communication P2P
### Outils
- **4NK_template** : Template Docker pour les nouveaux projets
- **4NK_wallet** : Application wallet
## 🚀 Démarrage rapide
### Prérequis
- Docker et Docker Compose v2
- Rust (latest stable)
- Node.js 18+
- Git
### Installation
```bash
# Cloner le dépôt
git clone <repository-url>
cd 4NK_dev
# Configurer l'environnement
./setup_dev_env.sh
# Démarrer l'infrastructure
cd 4NK_node
./scripts/manage_services.sh start
```
## 📦 Gestion des dépendances WASM
### État actuel
- **sdk_common** : ✅ Migré vers `flate2` (remplace `zstd`)
- **sdk_client** : 🔄 Stub WASM temporaire avec `flate2` (en attente de migration complète)
- **sdk_signer** : ✅ Compatible avec le stub WASM
### Migration en cours
1. **Phase 1** : ✅ Migration `sdk_common` vers `flate2`
2. **Phase 2** : 🔄 Migration `sdk_client` vers `k256` et `flate2`
3. **Phase 3** : ⏳ Intégration complète WASM
4. **Phase 4** : ⏳ Déploiement
## 🛠️ Développement
### Compilation des projets
```bash
# Compiler tous les projets Rust
for project in sdk_common sdk_client sdk_storage; do
cd $project && cargo build --release && cd ..
done
# Compiler les projets Node.js
for project in sdk_signer sdk_signer_client ihm_client; do
cd $project && npm install && npm run build && cd ..
done
```
### Gestion des services
```bash
# Arrêter tous les services
cd 4NK_node && ./scripts/manage_services.sh stop
# Nettoyer l'environnement
./scripts/manage_services.sh clean
# Redémarrer les services
./scripts/manage_services.sh start
```
## 📚 Documentation
- [Résultats de compilation](COMPILATION_RESULTS.md) - Statut détaillé de tous les projets
- [Modules Docker](docs/modules.md) - Documentation des modules Docker
- [Changelog](CHANGELOG.md) - Historique des versions
## 🔧 Scripts utiles
- `setup_dev_env.sh` : Configuration de l'environnement de développement
- `update_repos.sh` : Mise à jour des dépôts depuis repos.csv
- `4NK_node/scripts/manage_services.sh` : Gestion des services Docker
## 📋 Structure des branches
- **main** : Branche principale pour 4NK_dev et 4NK_node
- **docker-support** : Branche de développement pour les SDKs et clients
- **dev** : Branche de développement pour certaines fonctionnalités
## 🤝 Contribution
1. Créer une branche depuis `docker-support` ou `main` selon le projet
2. Développer et tester localement
3. Pousser les modifications sur la branche appropriée
4. Créer une pull request
## 📄 Licence
MIT License - voir les fichiers LICENSE individuels dans chaque projet.

1
VERSION Normal file
View File

@ -0,0 +1 @@
v2025.09.1

11
code.code-workspace Normal file
View File

@ -0,0 +1,11 @@
{
"folders": [
{
"path": ".."
},
{
"path": "../../.4nk_template"
}
],
"settings": {}
}

1
deploy4NK_node Submodule

@ -0,0 +1 @@
Subproject commit 2f663d20a28ff0dc42ef0ebf29cc405329fd23a8

1
deploy4NK_template Submodule

@ -0,0 +1 @@
Subproject commit 6ced5d29231b711bd0c8eab591091c810d0147d7

13
docs/architecture.md Normal file
View File

@ -0,0 +1,13 @@
# Architecture
## Arborescence
- `modules/`: dépôts modulaires (SDK, clients, outils)
- `deploy/`: dépôts de déploiement (ex: `deploy/4NK_node`)
- `projects/<projet>/<repo>`: dépôts par projets (ex: `projects/lecoffre/...`)
## Principes
- Submodules décrits dans `.gitmodules` avec `path`, `url`, `branch`.
- CI centrale dans `/.gitea/workflows/` pour build/push Docker.
- Images taggées par `DOCKER_TAG`.

15
docs/ci.md Normal file
View File

@ -0,0 +1,15 @@
# Intégration Continue (CI)
## Workflow
- Fichier: `.gitea/workflows/dev.yml`
- Trigger unique: push sur nimporte quelle branche (`*`).
## Résolution de DOCKER_TAG
- Nom de la branche courante (la branche est le `DOCKER_TAG`).
## Build
- Script: `scripts/build_and_push.sh <DOCKER_TAG>` (obligatoire)
- Parcourt les submodules; build/push si `Dockerfile` présent.

13
docs/development.md Normal file
View File

@ -0,0 +1,13 @@
# Développement local
## Prérequis
- Git + accès SSH à `git.4nkweb.com`
- Docker + Buildx
## Commandes utiles
- Synchroniser submodules: `git submodule sync --recursive`
- Initialiser/mettre à jour: `git submodule update --init --recursive`
- Déclencher CI via branche: `scripts/commit_tag_env.sh <tag>`
- Taguer tous les repos: `scripts/tag.sh <tag>`

6
docs/docker_registry.md Normal file
View File

@ -0,0 +1,6 @@
# Registry Docker
- Registry: `git.4nkweb.com`
- Namespace: `4nk`
- Tagging: basé sur `DOCKER_TAG` (obligatoire)
- Politique: ne jamais utiliser ni modifier un tag Docker `dev`.

15
docs/faq.md Normal file
View File

@ -0,0 +1,15 @@
# FAQ
## Est-ce que la CI sapplique aux submodules ?
- Oui pour le build/push Docker (via 4NK_dev), non pour déclencher leur CI interne.
## Comment choisir le tag dimage ?
- Message de commit: `ci: docker_tag=<valeur>`
- Ou `.ci/tag.env` via branche dédiée
- Ou nom de la branche
## Le tag Docker `dev` est-il utilisé ?
- Non. Il ne doit jamais être utilisé ni modifié.

24
docs/index.md Normal file
View File

@ -0,0 +1,24 @@
# 4NK_dev — Documentation du projet
## Objectif du dépôt
- Dépôt agrégateur des projets 4NK via submodules Git.
- Normalise larborescence: `modules/`, `deploy/`, `projects/<projet>/<repo>`.
- Centralise CI de build/push dimages Docker pour chaque submodule éligible.
## Contenu de la documentation
- Architecture: voir `architecture.md`
- Submodules: voir `submodules.md`
- CI et publication Docker: voir `ci.md`
- Registry et tags: voir `docker_registry.md`
- Versioning et release: voir `release_versioning.md`
- Développement local: voir `development.md`
- Scripts utilitaires: voir `scripts.md`
- FAQ: voir `faq.md`
## Conventions
- Lint Markdown appliqué.
- Pas dexemples dans la documentation.
- Les changements doivent toujours être décrits dans `CHANGELOG.md` et `VERSION`.

View File

@ -1,37 +0,0 @@
# Modules Docker (4NK_dev)
## 4NK_node
- Sappuie sur le `docker-compose.yml` existant dans `4NK_node/`.
- Scripts:
- `modules/4NK_node/build.sh` : construit les services avec `docker compose build`.
- `modules/4NK_node/up.sh` : démarre les services en détaché.
- `modules/4NK_node/down.sh` : arrête et nettoie les services.
- `modules/4NK_node/logs.sh` : affiche les logs (suivi).
- `modules/4NK_node/clean.sh` : down -v + prune dimages.
- Version/tag: lit `4NK_node/VERSION` si présent, sinon utilise `git describe` pour définir `COMPOSE_PROJECT_NAME`.
## 4NK_template
- Dockerfile multi-stage Node fourni dans `modules/4NK_template/Dockerfile`.
- Scripts:
- `modules/4NK_template/build.sh` : build de limage à partir de `4NK_template/`.
- `modules/4NK_template/run.sh` : exécute limage, mappe le port 3000.
- `modules/4NK_template/clean.sh` : supprime limage construite et fait un prune.
- Version/tag: lit `4NK_template/VERSION` si présent, sinon `git describe`.
## Prérequis
- Docker et Docker Compose (plugin) installés.
## Utilisation (séquentielle)
1. Construire 4NK_node
- `bash modules/4NK_node/build.sh`
2. Démarrer 4NK_node
- `bash modules/4NK_node/up.sh`
3. Construire 4NK_template
- `bash modules/4NK_template/build.sh`
4. Lancer 4NK_template
- `bash modules/4NK_template/run.sh`
5. Logs 4NK_node
- `bash modules/4NK_node/logs.sh`
6. Arrêt 4NK_node
- `bash modules/4NK_node/down.sh`

View File

@ -0,0 +1,7 @@
# Versioning & Release
- Fichier `VERSION` et `CHANGELOG.md` à jour à chaque modification significative.
- Tags Git:
- `dev`: pointe sur la tête de la branche `dev` (ne pas utiliser en Docker)
- Tags de CI: `dev-test*` selon besoin
- Politique Docker: images taggées par `DOCKER_TAG` uniquement.

16
docs/scripts.md Normal file
View File

@ -0,0 +1,16 @@
# Scripts
## build_and_push.sh
- Usage: `scripts/build_and_push.sh <DOCKER_TAG>` (obligatoire)
- Construit et pousse chaque submodule avec `Dockerfile`.
## tag.sh
- Usage: `scripts/tag.sh [TAG_NAME]` (défaut `dev-test`)
- Pose le tag sur le dépôt racine et tous les submodules.
## commit_tag_env.sh
- Usage: `scripts/commit_tag_env.sh <TAG_NAME>`
- Crée/checkout une branche du même nom et écrit `.ci/tag.env`.

11
docs/submodules.md Normal file
View File

@ -0,0 +1,11 @@
# Submodules
## Déclaration
- Chaque sous-dépôt est déclaré dans `.gitmodules` avec `path`, `url`, `branch`.
## Bonnes pratiques
- Exécuter `git submodule sync --recursive` après modification de `.gitmodules`.
- Utiliser `git submodule update --init --recursive` pour initialiser.
- Éviter les chemins ambigus; respecter `modules/`, `deploy/`, `projects/<projet>/<repo>`.

1
modules/4NK_IA Submodule

@ -0,0 +1 @@
Subproject commit 0c8c0f1c390f4109a192c32f1da3fba07a204d12

1
modules/bitcoin-core Submodule

@ -0,0 +1 @@
Subproject commit 2c8a478db4b84e03cc376e52f463b828ab9366f6

@ -0,0 +1 @@
Subproject commit a6a5e879ca0198931cbc6e5a1a8a76d9b653c532

1
modules/ihm_client Submodule

@ -0,0 +1 @@
Subproject commit c8ac815e2bc1673468d476058137663b585600de

@ -0,0 +1 @@
Subproject commit 1c9c625bb6641ee7e12c81244553082d5e5c17ff

1
modules/sdk_client Submodule

@ -0,0 +1 @@
Subproject commit c09135c4eb785fa5ef242cd106bb1e628d5f68fa

1
modules/sdk_common Submodule

@ -0,0 +1 @@
Subproject commit e205229e9219f6c3ad322a462903d2a740731aa3

1
modules/sdk_relay Submodule

@ -0,0 +1 @@
Subproject commit a056d44cbf61f75f7c71add30d94e30168de7018

1
modules/sdk_signer Submodule

@ -0,0 +1 @@
Subproject commit 83b21cb815458a6b662eb7d4d76f4fac25ca9b29

1
modules/sdk_storage Submodule

@ -0,0 +1 @@
Subproject commit 120a3dc8d0b8398a4c83e27e24eff14c76f66a8f

1
modules/sp-client Submodule

@ -0,0 +1 @@
Subproject commit b1710e7d16592e52a2a77618ceb4d56d5d51db8e

1
modules/tor Submodule

@ -0,0 +1 @@
Subproject commit 27d4ba90f6dbf0c80d518a358b9600ae789509e4

@ -0,0 +1 @@
Subproject commit 9e2d56383b1ddea92149f2e201cad630d5e57b30

@ -0,0 +1 @@
Subproject commit 6e505b2f32467af5852928215d2dc18d26917824

@ -0,0 +1 @@
Subproject commit cfa9514be9a5e4deae9dccb2fe03780b8707ea43

@ -0,0 +1 @@
Subproject commit a78666b4a985e4e3e4deb19f4cbb10e4e4202c9b

View File

@ -1,11 +0,0 @@
name,url,type,target,directory
sdk_storage,https://git.4nkweb.com/4nk/sdk_storage.git,branch,docker-support,sdk_storage
sdk_signer_client,https://git.4nkweb.com/4nk/sdk_signer_client.git,create_from,master->docker-support,sdk_signer_client
sdk_signer,https://git.4nkweb.com/4nk/sdk_signer.git,branch,docker-support,sdk_signer
ihm_client,https://git.4nkweb.com/4nk/ihm_client.git,branch,docker-support,ihm_client
sdk_relay,https://git.4nkweb.com/4nk/sdk_relay.git,branch,docker-support,sdk_relay
sdk_common,https://git.4nkweb.com/4nk/sdk_common.git,branch,docker-support,sdk_common
4NK_wallet,https://git.4nkweb.com/4nk/4NK_wallet.git,create_from,main->docker-support,4NK_wallet
sdk_client,https://git.4nkweb.com/4nk/sdk_client.git,branch,docker-support,sdk_client
4NK_template,https://git.4nkweb.com/4nk/4NK_template.git,branch,main,4NK_template
4NK_node,git@git.4nkweb.com:4nk/4NK_node.git,branch,main,4NK_node
1 name url type target directory
2 sdk_storage https://git.4nkweb.com/4nk/sdk_storage.git branch docker-support sdk_storage
3 sdk_signer_client https://git.4nkweb.com/4nk/sdk_signer_client.git create_from master->docker-support sdk_signer_client
4 sdk_signer https://git.4nkweb.com/4nk/sdk_signer.git branch docker-support sdk_signer
5 ihm_client https://git.4nkweb.com/4nk/ihm_client.git branch docker-support ihm_client
6 sdk_relay https://git.4nkweb.com/4nk/sdk_relay.git branch docker-support sdk_relay
7 sdk_common https://git.4nkweb.com/4nk/sdk_common.git branch docker-support sdk_common
8 4NK_wallet https://git.4nkweb.com/4nk/4NK_wallet.git create_from main->docker-support 4NK_wallet
9 sdk_client https://git.4nkweb.com/4nk/sdk_client.git branch docker-support sdk_client
10 4NK_template https://git.4nkweb.com/4nk/4NK_template.git branch main 4NK_template
11 4NK_node git@git.4nkweb.com:4nk/4NK_node.git branch main 4NK_node

84
scripts/build_and_push.sh Normal file
View File

@ -0,0 +1,84 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
REGISTRY=${REGISTRY:-git.4nkweb.com}
NAMESPACE=${NAMESPACE:-4nk}
# Support d'un paramètre positionnel prioritaire pour le tag
if [ "${1:-}" != "" ]; then
DOCKER_TAG="$1"
fi
if [ -z "${DOCKER_TAG:-}" ]; then
echo "[docker][erreur] DOCKER_TAG non défini (obligatoire). Fournissez-le en argument ou via l'environnement." >&2
exit 1
fi
echo "[docker] registry=${REGISTRY} namespace=${NAMESPACE} tag=${DOCKER_TAG}"
if ! command -v docker >/dev/null 2>&1; then
echo "[docker][erreur] docker introuvable" >&2
exit 1
fi
if [ ! -f .gitmodules ]; then
echo "[docker][erreur] .gitmodules introuvable dans $(pwd)" >&2
exit 1
fi
# Prépare le répertoire de logs
LOG_DIR="log/ci/${DOCKER_TAG}"
mkdir -p "${LOG_DIR}"
SUMMARY_FILE="${LOG_DIR}/summary.txt"
: > "${SUMMARY_FILE}"
# Parcourt les submodules déclarés
mapfile -t submodules < <(git config -f .gitmodules --name-only --get-regexp 'submodule\..*\.path' | sed -E 's/\.path$//')
for name in "${submodules[@]}"; do
path=$(git config -f .gitmodules --get "${name}.path" || true)
url=$(git config -f .gitmodules --get "${name}.url" || true)
branch=$(git config -f .gitmodules --get "${name}.branch" || echo "master")
if [ -z "${path}" ] || [ -z "${url}" ]; then
echo "[docker][warn] entrée incomplète pour ${name}, ignoré" >&2
continue
fi
image_name=$(basename "${path}")
full_ref="${REGISTRY}/${NAMESPACE}/${image_name}:${DOCKER_TAG}"
if [ ! -d "${path}" ]; then
echo "[docker][warn] sous-dossier ${path} manquant, on saute" >&2
continue
fi
if [ ! -f "${path}/Dockerfile" ]; then
echo "[docker] aucun Dockerfile dans ${path}, ignoré"
continue
fi
log_file="${LOG_DIR}/$(basename "${path}").log"
echo "[docker] build ${full_ref} depuis ${path} (branche ${branch}) | log: ${log_file}"
{
echo "== BUILD ${full_ref} =="
date -Is
docker buildx build \
--pull \
--ssh default \
--progress=plain \
--tag "${full_ref}" \
"${path}"
} 2>&1 | tee -a "${log_file}"
echo "[docker] push ${full_ref} | log: ${log_file}"
{
echo "== PUSH ${full_ref} =="
date -Is
docker push "${full_ref}"
} 2>&1 | tee -a "${log_file}"
echo "${full_ref} ${log_file}" >> "${SUMMARY_FILE}"
done
echo "[docker] terminé"
echo "[docker] récapitulatif: ${SUMMARY_FILE}"

39
scripts/commit_tag_env.sh Normal file
View File

@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
# Usage: ./scripts/commit_tag_env.sh <TAG_NAME>
if [ $# -lt 1 ]; then
echo "[ci] usage: $0 <TAG_NAME>" >&2
exit 1
fi
TAG_NAME="$1"
ROOT_DIR="/home/desk/code/4NK_dev"
TAG_BRANCH="$TAG_NAME"
cd "$ROOT_DIR"
echo "[ci] préparer la branche ${TAG_BRANCH} (source dev si besoin)"
git fetch origin --prune >/dev/null 2>&1 || true
if git show-ref --verify --quiet "refs/heads/${TAG_BRANCH}"; then
git checkout "${TAG_BRANCH}"
else
if git ls-remote --exit-code --heads origin "${TAG_BRANCH}" >/dev/null 2>&1; then
git checkout -b "${TAG_BRANCH}" "origin/${TAG_BRANCH}"
else
git checkout -B "${TAG_BRANCH}" "origin/dev"
fi
fi
echo "[ci] écrire .ci/tag.env avec DOCKER_TAG=${TAG_NAME}"
mkdir -p .ci
printf "DOCKER_TAG=%s\n" "$TAG_NAME" > .ci/tag.env
git add .ci/tag.env
git commit -m "ci(tag): set DOCKER_TAG=${TAG_NAME} in .ci/tag.env"
git push origin "HEAD:refs/heads/${TAG_BRANCH}"
echo "[ci] terminé: branche ${TAG_BRANCH} mise à jour"

View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -euo pipefail
git submodule update --init --recursive
echo "[readd] git submodule update --init --recursive terminé"

View File

@ -0,0 +1,48 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
echo "[sync] lecture des submodules depuis .gitmodules"
if [ ! -f .gitmodules ]; then
echo "[sync][erreur] .gitmodules introuvable dans $(pwd)" >&2
exit 1
fi
# Récupère la liste des sous-modules (noms logiques)
mapfile -t submodules < <(git config -f .gitmodules --name-only --get-regexp 'submodule\..*\.path' | sed -E 's/\.path$//')
for name in "${submodules[@]}"; do
path=$(git config -f .gitmodules --get "${name}.path" || true)
url=$(git config -f .gitmodules --get "${name}.url" || true)
branch=$(git config -f .gitmodules --get "${name}.branch" || echo "master")
if [ -z "${path}" ] || [ -z "${url}" ]; then
echo "[sync][warn] entrée incomplète pour ${name}, ignoré" >&2
continue
fi
echo "[sync] => ${path} (${url}) branch=${branch}"
if [ ! -d "${path}/.git" ]; then
echo "[sync] init submodule ${path}"
git submodule update --init --recursive -- "${path}"
fi
echo "[sync] fetch ${path}"
git -C "${path}" fetch --all --prune
echo "[sync] checkout ${branch} dans ${path}"
if ! git -C "${path}" checkout "${branch}" 2>/dev/null; then
if git -C "${path}" rev-parse --verify "origin/${branch}" >/dev/null 2>&1; then
git -C "${path}" checkout -b "${branch}" "origin/${branch}"
else
echo "[sync][warn] branche ${branch} introuvable pour ${path}, on reste sur la branche courante" >&2
fi
fi
echo "[sync] pull ${path}"
git -C "${path}" pull --ff-only || true
done
echo "[sync] terminé"

91
scripts/tag.sh Normal file
View File

@ -0,0 +1,91 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
# Usage: ./tag.sh [TAG_NAME]
# Par défaut, TAG_NAME="dev-test"
TAG_NAME="${1:-dev-test}"
ROOT_DIR="/home/desk/code/4NK_dev"
print_info() { echo "[tag] $*"; }
print_warn() { echo "[tag][warn] $*"; }
delete_tag_if_exists() {
local tag="$1"
if git show-ref --tags --quiet --verify "refs/tags/${tag}"; then
git tag -d "${tag}" >/dev/null || true
git push origin ":refs/tags/${tag}" >/dev/null || true
fi
}
ensure_branch_checked_out() {
local branch="$1"
if git rev-parse --verify "origin/${branch}" >/dev/null 2>&1; then
git checkout "${branch}" >/dev/null 2>&1 || git checkout -b "${branch}" "origin/${branch}" >/dev/null 2>&1 || true
git pull --ff-only >/dev/null 2>&1 || true
else
print_info "branche ${branch} introuvable, utilisation de la branche courante"
fi
}
tag_current_repo() {
local tag="$1"
local ref_sha
ref_sha=$(git rev-parse --verify HEAD)
delete_tag_if_exists "${tag}"
git tag -a "${tag}" -m "CI ${tag} trigger" "${ref_sha}"
git push origin "refs/tags/${tag}"
}
get_submodule_names() {
git config -f .gitmodules --name-only --get-regexp 'submodule\..*\.path' | sed -E 's/\.path$//'
}
tag_root_repo() {
cd "${ROOT_DIR}"
print_info "repository racine: $(basename "${ROOT_DIR}") -> ${TAG_NAME}"
local dev_head
dev_head=$(git rev-parse --verify refs/heads/dev)
delete_tag_if_exists "${TAG_NAME}"
git tag -a "${TAG_NAME}" -m "CI ${TAG_NAME} trigger" "${dev_head}"
git push origin "refs/tags/${TAG_NAME}"
}
tag_submodules() {
print_info "lecture des submodules depuis .gitmodules"
local names
mapfile -t names < <(get_submodule_names)
for name in "${names[@]}"; do
local sm_path sm_url sm_branch
sm_path=$(git config -f .gitmodules --get "${name}.path" || true)
sm_url=$(git config -f .gitmodules --get "${name}.url" || true)
sm_branch=$(git config -f .gitmodules --get "${name}.branch" || echo dev)
if [ -z "${sm_path}" ] || [ -z "${sm_url}" ]; then
print_warn "entrée incomplète: ${name}, ignorée"
continue
fi
if [ ! -d "${sm_path}" ]; then
print_warn "dossier manquant: ${sm_path}, on saute"
continue
fi
print_info "${sm_path} (${sm_url}) -> ${TAG_NAME} sur branche ${sm_branch}"
(
cd "${sm_path}"
git fetch --all --prune >/dev/null 2>&1 || true
ensure_branch_checked_out "${sm_branch}"
tag_current_repo "${TAG_NAME}"
) || print_warn "échec sur ${sm_path}, on continue"
done
}
main() {
cd "${ROOT_DIR}"
tag_root_repo
tag_submodules
print_info "terminé: ${TAG_NAME} posé sur le repo racine et submodules accessibles"
}
main "$@"

26
tests/ci_dev_test.md Normal file
View File

@ -0,0 +1,26 @@
# Plan de tests CI "dev-test"
## Objectifs
- Vérifier que le tag `dev-test` déclenche le workflow.
- Vérifier la synchronisation des submodules sur leurs branches.
- Vérifier la construction et le push des images Docker pour les submodules avec `Dockerfile`.
## Pré-requis
- Secrets `REGISTRY_USERNAME` et `REGISTRY_PASSWORD` configurés.
- Accès au registry `git.4nkweb.com`.
## Scénarios
1. Tag `dev-test` sur le dépôt parent
- Attendu: workflow lancé, logs de sync visibles.
2. Submodule avec `Dockerfile`
- Attendu: image buildée et poussée avec tag `dev-test`.
3. Submodule sans `Dockerfile`
- Attendu: ignoré proprement.
## Vérifications
- Présence des images `git.4nkweb.com/4nk/<submodule>:dev-test` dans le registry.
- Logs dexécution sans erreurs fatales.

View File

@ -1,38 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
CSV_FILE="repos.csv"
IFS=,
while read -r name url type target directory; do
if [ "$name" = "name" ]; then continue; fi
echo "\n[Repo] $name -> $directory"
if [ ! -d "$directory" ]; then
echo "[Clone] $url"
git clone --progress "$url" "$directory" || true
fi
echo "[Fetch] $directory"
git -C "$directory" fetch --all --prune --tags --progress || true
case "$type" in
branch)
echo "[Checkout] $target"
if git -C "$directory" show-ref --verify --quiet "refs/remotes/origin/$target"; then
git -C "$directory" checkout "$target" 2>/dev/null || git -C "$directory" checkout -B "$target" "origin/$target"
git -C "$directory" reset --hard "origin/$target"
else
echo "[Warn] Branche $target introuvable pour $name"
fi
;;
create_from)
base="${target%%->*}"
newb="${target##*->}"
echo "[Create] $newb depuis $base"
if git -C "$directory" show-ref --verify --quiet "refs/remotes/origin/$base"; then
git -C "$directory" checkout -B "$newb" "origin/$base"
else
echo "[Error] Base $base introuvable pour $name"
fi
;;
*)
echo "[Warn] Type inconnu: $type"
;;
esac
done < "$CSV_FILE"