ci: normalize DOCKER_TAG from branch name; use buildx --push to publish
Some checks failed
dev-test-2 / build-and-push (push) Failing after 45s

This commit is contained in:
Nicolas Cantu 2025-09-10 13:45:31 +02:00
parent 656a9f79f9
commit 4fd60e0600
2 changed files with 7 additions and 9 deletions

View File

@ -48,5 +48,9 @@ jobs:
env: env:
REGISTRY: git.4nkweb.com REGISTRY: git.4nkweb.com
run: | run: |
DOCKER_TAG=$(git rev-parse --abbrev-ref HEAD) BR=$(git rev-parse --abbrev-ref HEAD)
# garde la dernière composante après '/'
DOCKER_TAG=${BR##*/}
# normalise en minuscules et remplace les chars invalides par '-'
DOCKER_TAG=$(printf "%s" "$DOCKER_TAG" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9_.-]/-/g')
bash scripts/build_and_push.sh "$DOCKER_TAG" bash scripts/build_and_push.sh "$DOCKER_TAG"

View File

@ -73,7 +73,7 @@ for name in "${submodules[@]}"; do
log_file="${LOG_DIR}/${image_name_variant}.log" log_file="${LOG_DIR}/${image_name_variant}.log"
echo "[docker] build ${full_ref_variant} depuis ${df_dir} (branche ${branch}) | log: ${log_file}" echo "[docker] build ${full_ref_variant} depuis ${df_dir} (branche ${branch}) | log: ${log_file}"
{ {
echo "== BUILD ${full_ref_variant} ==" echo "== BUILD+PUSH ${full_ref_variant} =="
echo "context=${df_dir} dockerfile=${df}" echo "context=${df_dir} dockerfile=${df}"
date -Is date -Is
docker buildx build \ docker buildx build \
@ -82,16 +82,10 @@ for name in "${submodules[@]}"; do
--progress=plain \ --progress=plain \
--file "${df}" \ --file "${df}" \
--tag "${full_ref_variant}" \ --tag "${full_ref_variant}" \
--push \
"${df_dir}" "${df_dir}"
} 2>&1 | tee -a "${log_file}" } 2>&1 | tee -a "${log_file}"
echo "[docker] push ${full_ref_variant} | log: ${log_file}"
{
echo "== PUSH ${full_ref_variant} =="
date -Is
docker push "${full_ref_variant}"
} 2>&1 | tee -a "${log_file}"
echo "${full_ref_variant} ${log_file}" >> "${SUMMARY_FILE}" echo "${full_ref_variant} ${log_file}" >> "${SUMMARY_FILE}"
done done
done done