size test
All checks were successful
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / build-rootfs-archives (push) Successful in 6m43s
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / generate-build-info (push) Successful in 58s
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / push-archives-to-repo (push) Successful in 55s
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / build-and-push-docker-images (push) Has been skipped
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / generate-changelogs (push) Has been skipped
All checks were successful
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / build-rootfs-archives (push) Successful in 6m43s
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / generate-build-info (push) Successful in 58s
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / push-archives-to-repo (push) Successful in 55s
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / build-and-push-docker-images (push) Has been skipped
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / generate-changelogs (push) Has been skipped
This commit is contained in:
@@ -180,6 +180,19 @@ jobs:
|
||||
|
||||
- name: Generate build-info.json per version
|
||||
run: |
|
||||
human_size() {
|
||||
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))
|
||||
done
|
||||
printf "%s%s\n" "$b" "${S[$s]}"
|
||||
}
|
||||
|
||||
cd upload-repo
|
||||
for version in buster bullseye bookworm docker-build; do
|
||||
echo "[INFO] Generating build-info.json for $version"
|
||||
@@ -188,21 +201,13 @@ jobs:
|
||||
|
||||
image="gitea.fithwum.tech/fithwum/debian-base:$version"
|
||||
|
||||
human_size() {
|
||||
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))
|
||||
done
|
||||
printf "%s%s\n" "$b" "${S[$s]}"
|
||||
}
|
||||
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")
|
||||
|
||||
# Remove any non-digit characters and fallback if empty
|
||||
size_bytes=${size_bytes//[^0-9]/}
|
||||
if [[ -z "$size_bytes" ]]; then size_bytes=0; fi
|
||||
|
||||
digest=$(docker inspect --format='{{index .RepoDigests 0}}' "$image" || echo "unknown")
|
||||
size_bytes=$(docker image inspect "$image" --format='{{.Size}}' || echo "0")
|
||||
size_human=$(human_size "$size_bytes")
|
||||
|
||||
jq -n --arg version "$version" \
|
||||
@@ -210,14 +215,14 @@ jobs:
|
||||
--arg build_time "$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
|
||||
--arg image_tag "$image" \
|
||||
--arg digest "$digest" \
|
||||
--argjson size "$size" \
|
||||
--arg image_size "$size_human" \
|
||||
'{
|
||||
version: $version,
|
||||
commit: $commit,
|
||||
build_time: $build_time,
|
||||
image_tag: $image_tag,
|
||||
digest: $digest,
|
||||
image_size: $size
|
||||
image_size: $image_size
|
||||
}' > "$infofile"
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user