From 190d80c0034ccfca6dc28031e40c6f30140ce33e Mon Sep 17 00:00:00 2001 From: shreddedbacon Date: Wed, 27 Jul 2022 15:32:00 +1000 Subject: [PATCH] feat: add image size information for built images --- .../build-deploy-docker-compose.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/images/kubectl-build-deploy-dind/build-deploy-docker-compose.sh b/images/kubectl-build-deploy-dind/build-deploy-docker-compose.sh index 11d1a5135f..975be59a92 100755 --- a/images/kubectl-build-deploy-dind/build-deploy-docker-compose.sh +++ b/images/kubectl-build-deploy-dind/build-deploy-docker-compose.sh @@ -694,6 +694,24 @@ if [[ "$BUILD_TYPE" == "pullrequest" || "$BUILD_TYPE" == "branch" ]]; then fi +set +x +# print information about built image sizes +function printBytes { + local -i bytes=$1; + echo "$(( (bytes + 1000000)/1000000 ))MB" +} +if [[ "${IMAGES_BUILD[@]}" ]]; then + echo "##############################################" + echo "Built image sizes:" + echo "##############################################" +fi +for IMAGE_NAME in "${!IMAGES_BUILD[@]}" +do + TEMPORARY_IMAGE_NAME="${IMAGES_BUILD[${IMAGE_NAME}]}" + echo -e "Image ${TEMPORARY_IMAGE_NAME}\t\t$(printBytes $(docker inspect ${TEMPORARY_IMAGE_NAME} | jq -r '.[0].Size'))" +done +set -x + set +x currentStepEnd="$(date +"%Y-%m-%d %H:%M:%S")" patchBuildStep "${buildStartTime}" "${previousStepEnd}" "${currentStepEnd}" "${NAMESPACE}" "imageBuildComplete" "Image Builds"