Skip to content

Commit e85a448

Browse files
kenhysWatson1978
andauthored
check multipart configuration (#24)
Signed-off-by: Kentaro Hayashi <hayashi@clear-code.com> Co-authored-by: Shizuo Fujita <fujita@clear-code.com>
1 parent b4d7d24 commit e85a448

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

check-s3-object.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ if [ -z "$PATTERN" ]; then
8888
exit 1
8989
fi
9090

91+
for cmd in aws numfmt jq curl md5sum sha256sum; do
92+
if [ -z "$(command -v $cmd)" ]; then
93+
echo -e "\e[31;40m[ERROR]\e[0m No $cmd command was detected. Please install it."
94+
exit 1
95+
fi
96+
done
97+
98+
9199
WORKING_DIR=$(mktemp -d)
92100

93101
echo "channel: $CHANNEL"
@@ -100,6 +108,27 @@ echo "repo_dir: $REPO_DIR"
100108
export AWS_PAGER=""
101109
mkdir -p $WORKING_DIR
102110

111+
multipart_chunksize=$(aws configure get $PROFILE.s3.multipart_chunksize)
112+
multipart_threshold=$(aws configure get $PROFILE.s3.multipart_threshold)
113+
if [ -z "$multipart_chunksize" -o -z "$multipart_threshold" ]; then
114+
echo -e "\e[31;40m[ERROR]\e[0m s3.multipart_chunksize and s3.multipart_threshold must be set"
115+
exit 1
116+
fi
117+
118+
threshold_literal="50M"
119+
if [ $(echo $multipart_chunksize | sed 's/B$//' | numfmt --from=iec) -lt $(numfmt --from=iec $threshold_literal) ]; then
120+
echo -e "\e[31;40m[ERROR]\e[0m s3.multipart_chunksize <$multipart_chunksize> must be greater than <$threshold_literal>"
121+
exit 1
122+
else
123+
echo -e "\e[32;40m[PASS]\e[0m s3.multipart_chunksize <$multipart_chunksize> is greater than <$threshold_literal>"
124+
fi
125+
if [ $(echo $multipart_threshold | sed 's/B$//' | numfmt --from=iec) -lt $(numfmt --from=iec $threshold_literal) ]; then
126+
echo -e "\e[31;40m[ERROR]\e[0m s3.multipart_threshold <$multipart_threshold> must be greater than <$threshold_literal>"
127+
exit 1
128+
else
129+
echo -e "\e[32;40m[PASS]\e[0m s3.multipart_threshold <$multipart_threshold> is greater than <$threshold_literal>"
130+
fi
131+
103132
for channel in $CHANNEL; do
104133
echo "checking $channel"
105134
for pkg in $(find "$REPO_DIR/$channel" -name "$PATTERN"); do

0 commit comments

Comments
 (0)