size add bytes
Some checks failed
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / build-rootfs-archives (push) Successful in 6m59s
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / generate-build-info (push) Successful in 1m3s
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / build-and-push-docker-images (push) Has been cancelled
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / generate-changelogs (push) Has been cancelled
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / push-archives-to-repo (push) Has been cancelled

This commit is contained in:
2025-07-06 05:26:07 -07:00
parent 1e2cd32431
commit 6e3b4bbdaf

View File

@@ -203,26 +203,28 @@ jobs:
digest=$(docker inspect --format='{{if .RepoDigests}}{{index .RepoDigests 0}}{{else}}unknown{{end}}' "$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 image inspect "$image" --format='{{.Size}}' 2>/dev/null || echo "0") 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]/} size_bytes=${size_bytes//[^0-9]/}
if [[ -z "$size_bytes" ]]; then size_bytes=0; fi if [[ -z "$size_bytes" ]]; then size_bytes=0; fi
size_human=$(human_size "$size_bytes") size_human=$(human_size "$size_bytes")
jq -n --arg version "$version" \ jq -n \
--arg commit "$(git rev-parse HEAD)" \ --arg version "$version" \
--arg build_time "$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \ --arg commit "$(git rev-parse HEAD)" \
--arg image_tag "$image" \ --arg build_time "$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
--arg digest "$digest" \ --arg image_tag "$image" \
--arg image_size "$size_human" \ --arg digest "$digest" \
'{ --arg image_size "$size_human" \
version: $version, --argjson image_size_bytes "$size_bytes" \
commit: $commit, '{
build_time: $build_time, version: $version,
image_tag: $image_tag, commit: $commit,
digest: $digest, build_time: $build_time,
image_size: $image_size image_tag: $image_tag,
}' > "$infofile" digest: $digest,
image_size: $image_size,
image_size_bytes: $image_size_bytes
}' > "$infofile"
done done
- name: Commit and push build-info if changed - name: Commit and push build-info if changed