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_REGISTRY: ${{ env.IMAGE_REGISTRY }}
|
||||||
IMAGE_ORG: ${{ env.IMAGE_ORG }}
|
IMAGE_ORG: ${{ env.IMAGE_ORG }}
|
||||||
IMAGE_REPO_TS: ${{ env.IMAGE_REPO_TS }}
|
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 }}
|
CACHE_DIR: ${{ env.CACHE_DIR }}
|
||||||
run: |
|
run: |
|
||||||
human_size() {
|
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
|
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
|
done
|
||||||
printf "%s%s\n" "$b" "${S[$s]}"
|
printf "%s%s\n" "$b" "${S[$s]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
versions=()
|
versions=()
|
||||||
[[ "${{ needs.check-for-changes.outputs.should_build_alpine }}" == "true" ]] && versions+=("alpine")
|
if [[ "${{ needs.check-for-changes.outputs.should_build_alpine }}" == "true" ]]; then
|
||||||
[[ "${{ needs.check-for-changes.outputs.should_build_debian }}" == "true" ]] && versions+=("debian")
|
versions+=("alpine")
|
||||||
[[ "${{ needs.check-for-changes.outputs.should_build_basic }}" == "true" ]] && versions+=("basic")
|
fi
|
||||||
|
if [[ "${{ needs.check-for-changes.outputs.should_build_debian }}" == "true" ]]; then
|
||||||
alpine_base_digest=$(docker inspect --format='{{index .RepoDigests 0}}' alpine:latest || echo "unknown")
|
versions+=("debian")
|
||||||
debian_base_digest=$(docker inspect --format='{{index .RepoDigests 0}}' gitea.fithwum.tech/${{ secrets.GIT_USERNAME }}/debian-base:bookworm || echo "unknown")
|
fi
|
||||||
basic_base_digest=$debian_base_digest
|
if [[ "${{ needs.check-for-changes.outputs.should_build_basic }}" == "true" ]]; then
|
||||||
|
versions+=("basic")
|
||||||
|
fi
|
||||||
|
|
||||||
for version in "${versions[@]}"; do
|
for version in "${versions[@]}"; do
|
||||||
echo "[INFO] Generating build-info.json for $version"
|
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"
|
infofile="$version/build-info.json"
|
||||||
image="${IMAGE_REGISTRY}/${IMAGE_ORG}/${IMAGE_REPO_TS}:$version"
|
mkdir -p "$(dirname "$infofile")"
|
||||||
|
|
||||||
echo "[DEBUG] Pulling $image"
|
if ! docker pull "$image"; then
|
||||||
docker pull "$image" || echo "[WARN] Failed to pull $image"
|
echo "[WARN] Failed to pull $image — setting fields to unknown/0"
|
||||||
|
|
||||||
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"
|
digest="unknown"
|
||||||
size_bytes=0
|
size_bytes=0
|
||||||
else
|
else
|
||||||
digest=$(docker inspect --format='{{index .RepoDigests 0}}' "$local_image" 2>/dev/null || echo "unknown")
|
digest=$(docker inspect --format='{{if .RepoDigests}}{{index .RepoDigests 0}}{{else}}unknown{{end}}' "$image" 2>/dev/null || echo "unknown")
|
||||||
size_bytes=$(docker inspect --format='{{.Size}}' "$local_image" 2>/dev/null || echo "0")
|
size_bytes=$(docker image inspect "$image" --format='{{.Size}}' 2>/dev/null || echo "0")
|
||||||
digest=${digest:-unknown}
|
size_bytes=${size_bytes//[^0-9]/}
|
||||||
size_bytes=${size_bytes:-0}
|
if [[ -z "$size_bytes" ]]; then size_bytes=0; fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
size_human=$(human_size "$size_bytes")
|
size_human=$(human_size "$size_bytes")
|
||||||
|
|
||||||
|
# base digest logic
|
||||||
base_digest="unknown"
|
base_digest="unknown"
|
||||||
case "$version" in
|
if [ "$version" = "alpine" ]; then
|
||||||
alpine) base_digest="$alpine_base_digest" ;;
|
base_digest=$(docker inspect --format='{{index .RepoDigests 0}}' alpine:latest 2>/dev/null || echo "unknown")
|
||||||
debian) base_digest="$debian_base_digest" ;;
|
elif [ "$version" = "debian" ] || [ "$version" = "basic" ]; then
|
||||||
basic) base_digest="$basic_base_digest" ;;
|
base_digest=$(docker inspect --format='{{index .RepoDigests 0}}' gitea.fithwum.tech/${{ secrets.GIT_USERNAME }}/debian-base:bookworm 2>/dev/null || echo "unknown")
|
||||||
esac
|
fi
|
||||||
|
|
||||||
echo "[DEBUG] Final base_digest for $version = $base_digest"
|
|
||||||
|
|
||||||
jq -n \
|
jq -n \
|
||||||
--arg version "$version" \
|
--arg version "$version" \
|
||||||
|
|||||||
Reference in New Issue
Block a user