test
All checks were successful
Build and Push Teamspeak Images on Base Image Update / check-for-changes (push) Successful in 6s
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-debian (push) Successful in 11s
Build and Push Teamspeak Images on Base Image Update / build-basic (push) Successful in 12s
Build and Push Teamspeak Images on Base Image Update / generate-build-info (push) Successful in 5s
Build and Push Teamspeak Images on Base Image Update / generate-changelogs (push) Has been skipped
All checks were successful
Build and Push Teamspeak Images on Base Image Update / check-for-changes (push) Successful in 6s
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-debian (push) Successful in 11s
Build and Push Teamspeak Images on Base Image Update / build-basic (push) Successful in 12s
Build and Push Teamspeak Images on Base Image Update / generate-build-info (push) Successful in 5s
Build and Push Teamspeak Images on Base Image Update / generate-changelogs (push) Has been skipped
This commit is contained in:
@@ -173,60 +173,58 @@ jobs:
|
||||
IMAGE_REGISTRY: ${{ env.IMAGE_REGISTRY }}
|
||||
IMAGE_ORG: ${{ env.IMAGE_ORG }}
|
||||
IMAGE_REPO_TS: ${{ env.IMAGE_REPO_TS }}
|
||||
ALPINE_DIGEST: ${{ needs.check-for-changes.outputs.alpine_digest }}
|
||||
DEBIAN_DIGEST: ${{ needs.check-for-changes.outputs.debian_digest }}
|
||||
BASIC_DIGEST: ${{ needs.check-for-changes.outputs.basic_digest }}
|
||||
CACHE_DIR: ${{ env.CACHE_DIR }}
|
||||
run: |
|
||||
human_size() {
|
||||
local b=$1 d='' s=0 S=(B KB MB GB TB)
|
||||
local b=$1
|
||||
local d=''
|
||||
local s=0
|
||||
local 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=()
|
||||
[[ "${{ 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")
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
for version in "${versions[@]}"; do
|
||||
echo "[INFO] Generating build-info.json for $version"
|
||||
mkdir -p "$version"
|
||||
image="${IMAGE_REGISTRY}/${IMAGE_ORG}/${IMAGE_REPO_TS}:${version}"
|
||||
infofile="$version/build-info.json"
|
||||
image="${IMAGE_REGISTRY}/${IMAGE_ORG}/${IMAGE_REPO_TS}:$version"
|
||||
mkdir -p "$(dirname "$infofile")"
|
||||
|
||||
echo "[DEBUG] Pulling $image"
|
||||
docker pull "$image" || echo "[WARN] Failed to pull $image"
|
||||
|
||||
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
|
||||
if ! docker pull "$image"; then
|
||||
echo "[WARN] Failed to pull $image — setting fields to unknown/0"
|
||||
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}
|
||||
digest=$(docker inspect --format='{{if .RepoDigests}}{{index .RepoDigests 0}}{{else}}unknown{{end}}' "$image" 2>/dev/null || echo "unknown")
|
||||
size_bytes=$(docker image inspect "$image" --format='{{.Size}}' 2>/dev/null || echo "0")
|
||||
size_bytes=${size_bytes//[^0-9]/}
|
||||
if [[ -z "$size_bytes" ]]; then size_bytes=0; fi
|
||||
fi
|
||||
|
||||
size_human=$(human_size "$size_bytes")
|
||||
|
||||
# base digest logic
|
||||
base_digest="unknown"
|
||||
case "$version" in
|
||||
alpine) base_digest="$alpine_base_digest" ;;
|
||||
debian) base_digest="$debian_base_digest" ;;
|
||||
basic) base_digest="$basic_base_digest" ;;
|
||||
esac
|
||||
|
||||
echo "[DEBUG] Final base_digest for $version = $base_digest"
|
||||
if [ "$version" = "alpine" ]; then
|
||||
base_digest=$(docker inspect --format='{{index .RepoDigests 0}}' alpine:latest 2>/dev/null || echo "unknown")
|
||||
elif [ "$version" = "debian" ] || [ "$version" = "basic" ]; then
|
||||
base_digest=$(docker inspect --format='{{index .RepoDigests 0}}' gitea.fithwum.tech/${{ secrets.GIT_USERNAME }}/debian-base:bookworm 2>/dev/null || echo "unknown")
|
||||
fi
|
||||
|
||||
jq -n \
|
||||
--arg version "$version" \
|
||||
|
||||
Reference in New Issue
Block a user