Files
k3s/scripts/binary_size_check.sh
Jacob Blain Christen 0209f359fb [release 1.19] containerd: v1.4.4-k3s1 (#3085)
Addresses k3s-io/k3s#3068 and CVE-2021-21334

Signed-off-by: Jacob Blain Christen <jacob@rancher.com>
2021-03-17 14:36:56 -07:00

31 lines
610 B
Bash
Executable File

#!/bin/bash
set -e
if [ "${DEBUG}" = 1 ]; then
set -x
fi
cd $(dirname $0)/..
. ./scripts/version.sh
MAX_BINARY_SIZE=61000000
BIN_SUFFIX="-${ARCH}"
if [ ${ARCH} = amd64 ]; then
BIN_SUFFIX=""
elif [ ${ARCH} = arm ]; then
BIN_SUFFIX="-armhf"
fi
CMD_NAME="dist/artifacts/k3s${BIN_SUFFIX}"
SIZE=$(stat -c '%s' ${CMD_NAME})
if [ ${SIZE} -gt ${MAX_BINARY_SIZE} ]; then
echo "k3s binary ${CMD_NAME} size ${SIZE} exceeds max acceptable size of ${MAX_BINARY_SIZE} bytes"
exit 1
fi
echo "k3s binary ${CMD_NAME} size ${SIZE} is less than max acceptable size of ${MAX_BINARY_SIZE} bytes"
exit 0