From 833a285278864181fb9ad09442876fe40759fa92 Mon Sep 17 00:00:00 2001 From: Brad Davidson Date: Mon, 24 Oct 2022 22:53:48 +0000 Subject: [PATCH] Fix drone publish for arm Signed-off-by: Brad Davidson --- .drone.yml | 3 ++- scripts/build | 6 ++++++ scripts/version | 13 ++----------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.drone.yml b/.drone.yml index ff7cea0d..16d92580 100644 --- a/.drone.yml +++ b/.drone.yml @@ -206,7 +206,8 @@ steps: dockerfile: package/Dockerfile environment: ARCH: "${DRONE_STAGE_ARCH}" - DOCKER_BUILDKIT: "1" + # Don't enable buildkit on arm, it will barf on the platform variant mismatch + #DOCKER_BUILDKIT: "1" when: event: - tag diff --git a/scripts/build b/scripts/build index b77134d8..54004ee1 100755 --- a/scripts/build +++ b/scripts/build @@ -6,6 +6,12 @@ source $(dirname $0)/version cd $(dirname $0)/.. mkdir -p bin + +if [ ${ARCH} = armv7l ] || [ ${ARCH} = arm ]; then + export GOARCH="arm" + export GOARM="7" +fi + if [ "$(uname)" = "Linux" ]; then OTHER_LINKFLAGS="-extldflags -static -s" fi diff --git a/scripts/version b/scripts/version index 4343cf56..8d196f17 100755 --- a/scripts/version +++ b/scripts/version @@ -13,17 +13,8 @@ else VERSION="${COMMIT}${DIRTY}" fi -if [ -n "$ARCH" ]; then - GOARCH=${ARCH} -fi -if [ -z "$GOARCH" ]; then - GOARCH=$(go env GOHOSTARCH) -fi -if [ "$GOARCH" = "arm" ]; then - GOARM=7 -fi - -ARCH="${GOARCH}" +GO=${GO-go} +ARCH=${ARCH:-$("${GO}" env GOARCH)} SUFFIX="-${ARCH}" TAG=${TAG:-${VERSION}${SUFFIX}}