Fix size check and make script shell consistent

Related to #2205

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
pull/2487/head
Brad Davidson 4 years ago committed by Brad Davidson
parent 3e4fd7b41f
commit 50ea2d8164

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
set -e set -e
@ -7,10 +7,18 @@ if [ "${DEBUG}" = 1 ]; then
fi fi
MAX_BINARY_SIZE=61000000 MAX_BINARY_SIZE=61000000
SIZE=$(ls -l dist/artifacts/k3s | awk -F ' ' '{print $5}') 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 if [ ${SIZE} -gt ${MAX_BINARY_SIZE} ]; then
echo "k3s binary exceeds acceptable size of "${MAX_BINARY_SIZE} echo "k3s binary ${CMD_NAME} size ${SIZE} exceeds acceptable size of ${MAX_BINARY_SIZE}"
exit 1 exit 1
fi fi

@ -1,7 +1,8 @@
#!/bin/bash #!/bin/bash
set -e set -e
cd $(dirname $0) SCRIPT_DIR=$(dirname $0)
pushd $SCRIPT_DIR
./download ./download
if [ -z "$SKIP_VALIDATE" ]; then if [ -z "$SKIP_VALIDATE" ]; then
@ -10,4 +11,7 @@ fi
./build ./build
./package ./package
./binary_size_check.sh
popd
$SCRIPT_DIR/binary_size_check.sh

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
set -e set -e
set -x set -x

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
if [ -z "${DRONE_TAG}" ]; then if [ -z "${DRONE_TAG}" ]; then
echo "DRONE_TAG not defined" >&2 echo "DRONE_TAG not defined" >&2

Loading…
Cancel
Save