-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·31 lines (26 loc) · 1.09 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
source functions.sh
COMPONENT_NAME=`getComponentName`
BUILD_REPOSITORY_TAG=`getRepositoryTag`
logInfoMessage "I'll check the docker image layers for ${COMPONENT_NAME} of tag ${BUILD_REPOSITORY_TAG}"
sleep $SLEEP_DURATION
SIZE=`docker image inspect ${COMPONENT_NAME}:${BUILD_REPOSITORY_TAG} --format='{{.Size}}'`
IMAGE_SIZE=`expr $SIZE / 1000000`
logInfoMessage "Image size is ${IMAGE_SIZE}MB"
logInfoMessage "Image size allowed is ${MAX_ALLOWED_IMAGE_SIZE}MB"
if [ "${IMAGE_SIZE}" -gt "${MAX_ALLOWED_IMAGE_SIZE}" ]
then
generateOutput IMAGE_LAYER_VALIDATOR false "Build failed please check!!!!!"
if [ $VALIDATION_FAILURE_ACTION == "FAILURE" ]
then
logErrorMessage "Size of image is more then expected image size"
logErrorMessage "build unsucessfull"
exit 1
else
logWarningMessage "Size of image is more then expected image size please check"
fi
else
generateOutput IMAGE_LAYER_VALIDATOR true "Congratulations build succeeded!!!"
logInfoMessage "Size of a image is under expected image size"
logInfoMessage "build sucessfull"
fi