diff --git a/.gitea/workflows/dev-test.yml b/.gitea/workflows/dev-test.yml new file mode 100644 index 0000000..d50f52f --- /dev/null +++ b/.gitea/workflows/dev-test.yml @@ -0,0 +1,31 @@ +name: dev-test +on: + push: + tags: + - dev-test +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 + DOCKER_TAG: dev-test + run: | + bash scripts/build_and_push.sh diff --git a/.gitmodules b/.gitmodules index 9ae9c2b..956e98a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,64 +1,144 @@ [submodule "bitcoin-core"] - path = bitcoin-core + path = modules/bitcoin-core url = https://github.com/bitcoin/bitcoin.git branch = master [submodule "blindbit-oracle"] - path = blindbit-oracle - url = https://github.com/setavenger/blindbit-oracle.git + path = modules/blindbit-oracle + url = https://github.com/setavenger/blindbit-oracle branch = master [submodule "sp-client"] - path = sp-client + path = modules/sp-client url = https://github.com/Sosthene00/sp-client.git branch = dev [submodule "sdk_common"] - path = sdk_common + path = modules/sdk_common url = https://git.4nkweb.com/4nk/sdk_common.git branch = dev [submodule "sdk_client"] - path = sdk_client + path = modules/sdk_client url = https://git.4nkweb.com/4nk/sdk_client.git branch = dev [submodule "sdk_relay"] - path = sdk_relay + path = modules/sdk_relay url = https://git.4nkweb.com/4nk/sdk_relay.git branch = dev [submodule "sdk_storage"] - path = sdk_storage + path = modules/sdk_storage url = https://git.4nkweb.com/4nk/sdk_storage.git branch = dev -[submodule "sdk_signer"] - path = sdk_signer - url = https://git.4nkweb.com/4nk/sdk_signer.git +[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 = ihm_client + path = modules/ihm_client url = https://git.4nkweb.com/4nk/ihm_client.git branch = dev [submodule "4NK_node"] - path = 4NK_node + path = deploy4NK_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 "id_verif"] - path = id_verif + path = proect/id_verif/id_verif url = git@git.4nkweb.com:4nk/id_verif.git branch = docker-support-v2 [submodule "tor"] - path = tor + path = modules/tor url = https://github.com/torproject/tor.git branch = main [submodule "sdk_signer_client"] - path = sdk_signer_client + path = modules/sdk_signer_client url = https://git.4nkweb.com/4nk/sdk_signer_client.git - branch = master + branch = dev [submodule "4NK_template"] - path = 4NK_template + path = deploy4NK_template url = https://git.4nkweb.com/4nk/4NK_template.git branch = main [submodule "4NK_wallet"] - path = 4NK_wallet + path = project/4NK_wallet/4NK_wallet url = https://git.4nkweb.com/4nk/4NK_wallet.git branch = main [submodule "lecoffre-front"] - path = lecoffre-front + path = project/lecoffre/lecoffre-front url = https://git.4nkweb.com/4nk/lecoffre-front.git branch = dev +[submodule "lecoffre-back-mini"] + path = project/lecoffre/lecoffre-back-mini + url = https://git.4nkweb.com/4nk/lecoffre-back-mini.git + branch = dev +[submodule "modules/bitcoin-core"] + path = modules/bitcoin-core + url = https://github.com/bitcoin/bitcoin.git + branch = master +[submodule "modules/sp-client"] + path = modules/sp-client + url = https://github.com/Sosthene00/sp-client.git + branch = dev +[submodule "modules/sdk_common"] + path = modules/sdk_common + url = https://git.4nkweb.com/4nk/sdk_common.git + branch = dev +[submodule "modules/sdk_client"] + path = modules/sdk_client + url = https://git.4nkweb.com/4nk/sdk_client.git + branch = dev +[submodule "modules/sdk_relay"] + path = modules/sdk_relay + url = https://git.4nkweb.com/4nk/sdk_relay.git + branch = dev +[submodule "modules/sdk_storage"] + path = modules/sdk_storage + url = https://git.4nkweb.com/4nk/sdk_storage.git + branch = dev +[submodule "modules/sdk_signer"] + path = modules/sdk_signer + url = https://git.4nkweb.com/4nk/sdk_signer.git + branch = dev +[submodule "modules/ihm_client"] + path = modules/ihm_client + url = https://git.4nkweb.com/4nk/ihm_client.git + branch = dev +[submodule "deploy4NK_node"] + path = deploy4NK_node + url = git@git.4nkweb.com:4nk/4NK_node.git + branch = dev +[submodule "modules/4NK_IA"] + path = modules/4NK_IA + url = git@git.4nkweb.com:4nk/4NK_IA.git + branch = dev +[submodule "proect/id_verif/id_verif"] + path = proect/id_verif/id_verif + url = git@git.4nkweb.com:4nk/id_verif.git + branch = docker-support-v2 +[submodule "modules/tor"] + path = modules/tor + url = https://github.com/torproject/tor.git + branch = main +[submodule "deploy4NK_template"] + path = deploy4NK_template + url = https://git.4nkweb.com/4nk/4NK_template.git + branch = main +[submodule "project/4NK_wallet/4NK_wallet"] + path = project/4NK_wallet/4NK_wallet + url = https://git.4nkweb.com/4nk/4NK_wallet.git + branch = main +[submodule "project/lecoffre/lecoffre-front"] + path = project/lecoffre/lecoffre-front + url = https://git.4nkweb.com/4nk/lecoffre-front.git + branch = dev +[submodule "project/lecoffre/lecoffre-back-mini"] + path = project/lecoffre/lecoffre-back-mini + url = https://git.4nkweb.com/4nk/lecoffre-back-mini.git + branch = dev +[submodule "modules/blindbit-oracle"] + path = modules/blindbit-oracle + url = https://github.com/setavenger/blindbit-oracle + branch = master +[submodule "modules/sdk-signer-client"] + path = modules/sdk-signer-client + url = https://git.4nkweb.com/4nk/sdk-signer-client.git + branch = dev diff --git a/4NK_IA b/4NK_IA deleted file mode 160000 index 6f63821..0000000 --- a/4NK_IA +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6f63821728da12de0953ff745e47d5036e220428 diff --git a/CHANGELOG.md b/CHANGELOG.md index dbccd25..ea13bf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +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 diff --git a/VERSION b/VERSION index 4fe1131..84ad190 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2025.08.1 +v2025.09.1 diff --git a/bitcoin-core b/bitcoin-core deleted file mode 160000 index 3eea9fd..0000000 --- a/bitcoin-core +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3eea9fd39532eeda648e44de365fc4c9112f6fc6 diff --git a/4NK_node b/deploy4NK_node similarity index 100% rename from 4NK_node rename to deploy4NK_node diff --git a/4NK_template b/deploy4NK_template similarity index 100% rename from 4NK_template rename to deploy4NK_template diff --git a/docs/ci_dev_test.md b/docs/ci_dev_test.md new file mode 100644 index 0000000..503f4ef --- /dev/null +++ b/docs/ci_dev_test.md @@ -0,0 +1,35 @@ +# Politique CI "dev-test" + +Ce flux construit et pousse des images Docker pour chaque sous-dépôt listé dans `.gitmodules` qui contient un `Dockerfile`. Les images sont poussées dans le registry Gitea `git.4nkweb.com` sous le namespace `4nk` avec le tag `dev-test`. + +## Déclencheur + +- Tag Git: `dev-test` + +## Séquence + +1. Checkout du dépôt avec submodules (recursive) +2. Synchronisation des submodules sur la branche déclarée dans `.gitmodules` +3. Authentification au registry Gitea via secrets `REGISTRY_USERNAME` et `REGISTRY_PASSWORD` +4. Build et push des images Docker présentes dans chaque sous-module + +## Variables d’environnement + +- `REGISTRY`: `git.4nkweb.com` +- `NAMESPACE`: `4nk` +- `DOCKER_TAG`: `dev-test` + +## Scripts + +- `scripts/sync_submodules.sh`: synchronise les branches des submodules +- `scripts/build_and_push.sh`: build et push les images existantes + +## Secrets requis + +- `REGISTRY_USERNAME`: compte autorisé sur le registry +- `REGISTRY_PASSWORD`: mot de passe ou token + +## Notes + +- Les submodules sans `Dockerfile` sont ignorés. +- Les branches utilisées sont celles définies dans `.gitmodules` (clé `branch`). diff --git a/ihm_client b/ihm_client deleted file mode 160000 index 47c7d31..0000000 --- a/ihm_client +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 47c7d312492861860dc07a52850d1a5b8480b3e9 diff --git a/modules/4NK_IA b/modules/4NK_IA new file mode 160000 index 0000000..0c8c0f1 --- /dev/null +++ b/modules/4NK_IA @@ -0,0 +1 @@ +Subproject commit 0c8c0f1c390f4109a192c32f1da3fba07a204d12 diff --git a/modules/bitcoin-core b/modules/bitcoin-core new file mode 160000 index 0000000..2c8a478 --- /dev/null +++ b/modules/bitcoin-core @@ -0,0 +1 @@ +Subproject commit 2c8a478db4b84e03cc376e52f463b828ab9366f6 diff --git a/blindbit-oracle b/modules/blindbit-oracle similarity index 100% rename from blindbit-oracle rename to modules/blindbit-oracle diff --git a/modules/ihm_client b/modules/ihm_client new file mode 160000 index 0000000..c8ac815 --- /dev/null +++ b/modules/ihm_client @@ -0,0 +1 @@ +Subproject commit c8ac815e2bc1673468d476058137663b585600de diff --git a/modules/sdk-signer-client b/modules/sdk-signer-client new file mode 160000 index 0000000..1c9c625 --- /dev/null +++ b/modules/sdk-signer-client @@ -0,0 +1 @@ +Subproject commit 1c9c625bb6641ee7e12c81244553082d5e5c17ff diff --git a/sdk_client b/modules/sdk_client similarity index 100% rename from sdk_client rename to modules/sdk_client diff --git a/sdk_common b/modules/sdk_common similarity index 100% rename from sdk_common rename to modules/sdk_common diff --git a/sdk_relay b/modules/sdk_relay similarity index 100% rename from sdk_relay rename to modules/sdk_relay diff --git a/modules/sdk_signer b/modules/sdk_signer new file mode 160000 index 0000000..83b21cb --- /dev/null +++ b/modules/sdk_signer @@ -0,0 +1 @@ +Subproject commit 83b21cb815458a6b662eb7d4d76f4fac25ca9b29 diff --git a/sdk_storage b/modules/sdk_storage similarity index 100% rename from sdk_storage rename to modules/sdk_storage diff --git a/sp-client b/modules/sp-client similarity index 100% rename from sp-client rename to modules/sp-client diff --git a/tor b/modules/tor similarity index 100% rename from tor rename to modules/tor diff --git a/id_verif b/proect/id_verif/id_verif similarity index 100% rename from id_verif rename to proect/id_verif/id_verif diff --git a/4NK_wallet b/project/4NK_wallet/4NK_wallet similarity index 100% rename from 4NK_wallet rename to project/4NK_wallet/4NK_wallet diff --git a/project/lecoffre/lecoffre-back-mini b/project/lecoffre/lecoffre-back-mini new file mode 160000 index 0000000..cfa9514 --- /dev/null +++ b/project/lecoffre/lecoffre-back-mini @@ -0,0 +1 @@ +Subproject commit cfa9514be9a5e4deae9dccb2fe03780b8707ea43 diff --git a/lecoffre-front b/project/lecoffre/lecoffre-front similarity index 100% rename from lecoffre-front rename to project/lecoffre/lecoffre-front diff --git a/scripts/build_and_push.sh b/scripts/build_and_push.sh new file mode 100644 index 0000000..c650c2d --- /dev/null +++ b/scripts/build_and_push.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' + +REGISTRY=${REGISTRY:-git.4nkweb.com} +NAMESPACE=${NAMESPACE:-4nk} +DOCKER_TAG=${DOCKER_TAG:-dev-test} + +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 + +# 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 + + echo "[docker] build ${full_ref} depuis ${path} (branche ${branch})" + docker buildx build \ + --pull \ + --tag "${full_ref}" \ + "${path}" + + echo "[docker] push ${full_ref}" + docker push "${full_ref}" +done + +echo "[docker] terminé" diff --git a/scripts/readd_submodules.sh b/scripts/readd_submodules.sh new file mode 100644 index 0000000..2fa8c4a --- /dev/null +++ b/scripts/readd_submodules.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' + +echo "[readd] lecture .gitmodules" +mapfile -t entries < <(git config -f .gitmodules --name-only --get-regexp 'submodule\..*\.path' | sed -E 's/\.path$//') + +for name in "${entries[@]}"; 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 "[readd][warn] entrée incomplète pour ${name}, ignoré" >&2 + continue + fi + + mkdir -p "$(dirname "${path}")" + + if [ -d "${path}" ] && [ -d "${path}/.git" ]; then + echo "[readd] déjà présent: ${path}" + continue + fi + + if [ -d "${path}" ] && [ ! -d "${path}/.git" ]; then + echo "[readd][warn] ${path} existe sans .git, on supprime et on recrée" + rm -rf "${path}" + fi + + echo "[readd] ajout ${path} (${url}) branche=${branch}" + if ! git submodule add -f -b "${branch}" "${url}" "${path}"; then + echo "[readd][warn] échec ajout ${path}, on continue" >&2 + continue + fi +done + +echo "[readd] submodules ajoutés, initialisation recursive" +git submodule update --init --recursive +echo "[readd] terminé" diff --git a/scripts/sync_submodules.sh b/scripts/sync_submodules.sh new file mode 100644 index 0000000..d0d8b3b --- /dev/null +++ b/scripts/sync_submodules.sh @@ -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é" diff --git a/sdk_signer b/sdk_signer deleted file mode 160000 index 8449083..0000000 --- a/sdk_signer +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8449083237aaccc279bf1ba7483b887b6cb97f78 diff --git a/sdk_signer_client b/sdk_signer_client deleted file mode 160000 index 7d5861b..0000000 --- a/sdk_signer_client +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7d5861b831d01a7a7644f5f4ff1ffcd13203bac4 diff --git a/tests/ci_dev_test.md b/tests/ci_dev_test.md new file mode 100644 index 0000000..02b1a4e --- /dev/null +++ b/tests/ci_dev_test.md @@ -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/:dev-test` dans le registry. +- Logs d’exécution sans erreurs fatales.