Skip to content

Commit

Permalink
Fix size check and make script shell consistent
Browse files Browse the repository at this point in the history
Related to #2205

Signed-off-by: Brad Davidson <[email protected]>
  • Loading branch information
brandond committed Nov 5, 2020
1 parent 3e4fd7b commit 50ea2d8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
14 changes: 11 additions & 3 deletions scripts/binary_size_check.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

set -e

Expand All @@ -7,10 +7,18 @@ if [ "${DEBUG}" = 1 ]; then
fi

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
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
fi

Expand Down
8 changes: 6 additions & 2 deletions scripts/ci
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash
set -e

cd $(dirname $0)
SCRIPT_DIR=$(dirname $0)
pushd $SCRIPT_DIR

./download
if [ -z "$SKIP_VALIDATE" ]; then
Expand All @@ -10,4 +11,7 @@ fi

./build
./package
./binary_size_check.sh

popd

$SCRIPT_DIR/binary_size_check.sh
4 changes: 2 additions & 2 deletions scripts/dispatch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -e
set -x

Expand All @@ -8,4 +8,4 @@ REPO="https://api.github.com/repos/rancher/k3s-upgrade/dispatches"
curl -XPOST -u "${PAT_USERNAME}:${PAT_TOKEN}" \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Content-Type: application/json" $REPO \
--data '{"event_type": "create_tag", "client_payload": {"tag":"'"$DRONE_TAG"'"}}'
--data '{"event_type": "create_tag", "client_payload": {"tag":"'"$DRONE_TAG"'"}}'
2 changes: 1 addition & 1 deletion scripts/manifest
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

if [ -z "${DRONE_TAG}" ]; then
echo "DRONE_TAG not defined" >&2
Expand Down

0 comments on commit 50ea2d8

Please sign in to comment.