ci(log): write per-image logs to log/ci/ and summary.txt

This commit is contained in:
Nicolas Cantu 2025-09-10 12:46:20 +02:00
parent b926417227
commit 22ace2a948

View File

@ -25,6 +25,12 @@ if [ ! -f .gitmodules ]; then
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$//')
@ -51,14 +57,27 @@ for name in "${submodules[@]}"; do
continue
fi
echo "[docker] build ${full_ref} depuis ${path} (branche ${branch})"
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 \
--progress=plain \
--tag "${full_ref}" \
"${path}"
} 2>&1 | tee -a "${log_file}"
echo "[docker] push ${full_ref}"
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}"