From 6fb253c3e3c5b37b8f55c1acd812dd783311cdb0 Mon Sep 17 00:00:00 2001 From: Brian Downs Date: Fri, 4 Sep 2020 10:18:58 -0700 Subject: [PATCH 1/3] add binary size check script, makefile target, and added to drone Signed-off-by: Brian Downs --- .drone.yml | 3 +++ Makefile | 4 ++++ scripts/binary_size_check.sh | 17 +++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100755 scripts/binary_size_check.sh diff --git a/.drone.yml b/.drone.yml index 473960aac674..0cf494bc1129 100644 --- a/.drone.yml +++ b/.drone.yml @@ -15,6 +15,7 @@ steps: from_secret: gcloud_auth commands: - dapper ci + - make binary-size-check - echo "${DRONE_TAG}-amd64" | sed -e 's/+/-/g' >.tags volumes: - name: docker @@ -135,6 +136,7 @@ steps: from_secret: gcloud_auth commands: - dapper ci + - make binary-size-check - echo "${DRONE_TAG}-arm64" | sed -e 's/+/-/g' >.tags volumes: - name: docker @@ -238,6 +240,7 @@ steps: from_secret: gcloud_auth commands: - dapper ci + - make binary-size-check - echo "${DRONE_TAG}-arm" | sed -e 's/+/-/g' >.tags volumes: - name: docker diff --git a/Makefile b/Makefile index 172af7d4bc92..1b2ff55f05fe 100644 --- a/Makefile +++ b/Makefile @@ -29,3 +29,7 @@ generate: build/data build/data: mkdir -p $@ + +.PHONY: binary-size-check +binary-size-check: + scripts/binary_size_check.sh diff --git a/scripts/binary_size_check.sh b/scripts/binary_size_check.sh new file mode 100755 index 000000000000..d8dccaccbfd0 --- /dev/null +++ b/scripts/binary_size_check.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + +if [ "${DEBUG}" = 1 ]; then + set -x +fi + +MAX_BINARY_SIZE=61000000 +SIZE=$(ls -l dist/artifacts/k3s | awk -F ' ' '{print $5}') + +if [ ${SIZE} -gt ${MAX_BINARY_SIZE} ]; then + echo "k3s binary exceeds acceptable size of "${MAX_BINARY_SIZE} + exit 1 +fi + +exit 0 From dabc383933b4f1fa3fb4c878471a02573ebf0f77 Mon Sep 17 00:00:00 2001 From: Brian Downs Date: Fri, 4 Sep 2020 10:58:54 -0700 Subject: [PATCH 2/3] move script call to package script Signed-off-by: Brian Downs --- .drone.yml | 3 --- scripts/package | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index 0cf494bc1129..473960aac674 100644 --- a/.drone.yml +++ b/.drone.yml @@ -15,7 +15,6 @@ steps: from_secret: gcloud_auth commands: - dapper ci - - make binary-size-check - echo "${DRONE_TAG}-amd64" | sed -e 's/+/-/g' >.tags volumes: - name: docker @@ -136,7 +135,6 @@ steps: from_secret: gcloud_auth commands: - dapper ci - - make binary-size-check - echo "${DRONE_TAG}-arm64" | sed -e 's/+/-/g' >.tags volumes: - name: docker @@ -240,7 +238,6 @@ steps: from_secret: gcloud_auth commands: - dapper ci - - make binary-size-check - echo "${DRONE_TAG}-arm" | sed -e 's/+/-/g' >.tags volumes: - name: docker diff --git a/scripts/package b/scripts/package index e7b6dd2d0297..a86f02b58a05 100755 --- a/scripts/package +++ b/scripts/package @@ -10,3 +10,4 @@ fi ./package-cli ./package-image ./package-airgap +./binary_size_check.sh From bef445659968c0ee99641b88a2b466fa7570f5f8 Mon Sep 17 00:00:00 2001 From: Brian Downs Date: Fri, 4 Sep 2020 11:39:38 -0700 Subject: [PATCH 3/3] move script call to ci script Signed-off-by: Brian Downs --- scripts/ci | 2 ++ scripts/package | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/ci b/scripts/ci index a0de81fdeeb8..0e69a4637601 100755 --- a/scripts/ci +++ b/scripts/ci @@ -7,5 +7,7 @@ cd $(dirname $0) if [ -z "$SKIP_VALIDATE" ]; then ./validate fi + ./build ./package +./binary_size_check.sh diff --git a/scripts/package b/scripts/package index a86f02b58a05..e7b6dd2d0297 100755 --- a/scripts/package +++ b/scripts/package @@ -10,4 +10,3 @@ fi ./package-cli ./package-image ./package-airgap -./binary_size_check.sh