Skip to content

Commit 341e3e9

Browse files
committed
ci: prevent check_image_size return code 2 from providing overall script return code
1 parent 4887e66 commit 341e3e9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

.github/workflows/image.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
7575
- name: Test image size
7676
run: |
77-
set -euxo pipefail
77+
set -euo pipefail
7878
7979
# Check Docker image size against limits
8080
# Usage: check_image_size <image_name> <max_size_str>
@@ -112,11 +112,15 @@ jobs:
112112
113113
# Check image size - capture return code, not output
114114
check_image_size "glim-test" "100M"
115+
116+
# Handle return code
115117
if [ $? -ge 1 ]; then
116118
echo "::error::Image is too large"
117119
exit 1
118120
elif [ $? -eq 2 ]; then
119121
echo "::warning::Image is within 10% of the limit"
122+
exit 0 # required, otherwise the function call above will provide the exit code '2'
120123
elif [ $? -eq -1 ]; then
121124
echo "::warning::Image size check failed"
125+
exit 1
122126
fi

0 commit comments

Comments
 (0)