test
All checks were successful
Build and Push Teamspeak Images on Base Image Update / check-for-changes (push) Successful in 5s
Build and Push Teamspeak Images on Base Image Update / build-alpine (push) Successful in 7s
Build and Push Teamspeak Images on Base Image Update / build-basic (push) Successful in 9s
Build and Push Teamspeak Images on Base Image Update / build-debian (push) Successful in 11s
Build and Push Teamspeak Images on Base Image Update / generate-build-info (push) Successful in 4s
Build and Push Teamspeak Images on Base Image Update / generate-changelogs (push) Has been skipped

This commit is contained in:
2025-07-17 11:39:26 -07:00
parent 0ae8d7c599
commit 8fa7f2e201

View File

@@ -179,30 +179,18 @@ jobs:
CACHE_DIR: ${{ env.CACHE_DIR }}
run: |
human_size() {
local b=$1
local d=''
local s=0
local S=(B KB MB GB TB)
local b=$1 d='' s=0 S=(B KB MB GB TB)
while ((b >= 1024 && s < ${#S[@]}-1)); do
d=$((b % 1024))
b=$((b / 1024))
s=$((s + 1))
d=$((b % 1024)); b=$((b / 1024)); s=$((s + 1))
done
printf "%s%s\n" "$b" "${S[$s]}"
}
versions=()
if [[ "${{ needs.check-for-changes.outputs.should_build_alpine }}" == "true" ]]; then
versions+=("alpine")
fi
if [[ "${{ needs.check-for-changes.outputs.should_build_debian }}" == "true" ]]; then
versions+=("debian")
fi
if [[ "${{ needs.check-for-changes.outputs.should_build_basic }}" == "true" ]]; then
versions+=("basic")
fi
[[ "${{ needs.check-for-changes.outputs.should_build_alpine }}" == "true" ]] && versions+=("alpine")
[[ "${{ needs.check-for-changes.outputs.should_build_debian }}" == "true" ]] && versions+=("debian")
[[ "${{ needs.check-for-changes.outputs.should_build_basic }}" == "true" ]] && versions+=("basic")
# Pull and get digests of base images ONCE
alpine_base_digest=$(docker inspect --format='{{index .RepoDigests 0}}' alpine:latest || echo "unknown")
debian_base_digest=$(docker inspect --format='{{index .RepoDigests 0}}' gitea.fithwum.tech/${{ secrets.GIT_USERNAME }}/debian-base:bookworm || echo "unknown")
basic_base_digest=$debian_base_digest
@@ -213,14 +201,22 @@ jobs:
infofile="$version/build-info.json"
image="${IMAGE_REGISTRY}/${IMAGE_ORG}/${IMAGE_REPO_TS}:$version"
echo "[DEBUG] Inspecting image: $image"
echo "[DEBUG] Pulling $image"
docker pull "$image" || echo "[WARN] Failed to pull $image"
docker images --digests | grep "$version" || echo "[WARN] Image not listed locally"
local_image=$(docker images --format '{{.Repository}}:{{.Tag}}' | grep "${IMAGE_REPO_TS}:$version" | head -n1)
echo "[DEBUG] Resolved local image tag: $local_image"
if [[ -z "$local_image" ]]; then
digest="unknown"
size_bytes=0
else
digest=$(docker inspect --format='{{index .RepoDigests 0}}' "$local_image" 2>/dev/null || echo "unknown")
size_bytes=$(docker inspect --format='{{.Size}}' "$local_image" 2>/dev/null || echo "0")
digest=${digest:-unknown}
size_bytes=${size_bytes:-0}
fi
digest=$(docker inspect --format='{{index .RepoDigests 0}}' "$(docker images --format '{{.Repository}}:{{.Tag}}' | grep "${IMAGE_REPO_TS}:$version" | head -n1)" 2>/dev/null || echo "unknown")
size_bytes=$(docker inspect --format='{{.Size}}' "$(docker images --format '{{.Repository}}:{{.Tag}}' | grep "${IMAGE_REPO_TS}:$version" | head -n1)" 2>/dev/null || echo "0")
size_human=$(human_size "$size_bytes")
base_digest="unknown"
@@ -230,16 +226,7 @@ jobs:
basic) base_digest="$basic_base_digest" ;;
esac
# base_digest="unknown"
# if [ "$version" = "alpine" ]; then
# base_digest="${alpine_digest:-unknown}"
# elif [ "$version" = "debian" ]; then
# base_digest="${debian_digest:-unknown}"
# elif [ "$version" = "basic" ]; then
# base_digest="${basic_digest:-unknown}"
# fi
echo "[DEBUG] base_digest for $version = $base_digest"
echo "[DEBUG] Final base_digest for $version = $base_digest"
jq -n \
--arg version "$version" \
@@ -281,8 +268,14 @@ jobs:
echo "[INFO] No build-info changes to commit."
fi
ls -l basic/build-info.json || echo "❌ build-info not written"
cat basic/build-info.json || echo "❌ empty build-info"
- name: Show generated build-info
run: |
for version in alpine debian basic; do
echo "::group::$version build-info.json"
ls -l "$version/build-info.json" || echo "❌ missing"
cat "$version/build-info.json" || echo "❌ empty"
echo "::endgroup::"
done
generate-changelogs:
needs: generate-build-info