From 4d21a1d63ad3cd67058b33c08cca5ceccf6145b3 Mon Sep 17 00:00:00 2001 From: Ricardo Katz Date: Sat, 27 Jan 2024 19:01:06 -0300 Subject: [PATCH] Use go version directly from Makefile --- Makefile | 2 +- build/build.sh | 23 +++++++---------------- build/run-in-docker.sh | 9 ++------- 3 files changed, 10 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 5a2d81dd4..b289c7798 100644 --- a/Makefile +++ b/Makefile @@ -105,7 +105,7 @@ clean-chroot-image: ## Removes local image .PHONY: build build: ## Build ingress controller, debug tool and pre-stop hook. - build/run-in-docker.sh \ + E2E_IMAGE=golang:1.21.6-alpine3.19 USE_SHELL=/bin/sh build/run-in-docker.sh \ MAC_OS=$(MAC_OS) \ PKG=$(PKG) \ ARCH=$(ARCH) \ diff --git a/build/build.sh b/build/build.sh index 1ae505d91..9de796358 100755 --- a/build/build.sh +++ b/build/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Copyright 2018 The Kubernetes Authors. # @@ -25,24 +25,15 @@ set -o errexit set -o nounset set -o pipefail -declare -a mandatory -mandatory=( - PKG - ARCH - COMMIT_SHA - REPO_INFO - TAG -) -for var in "${mandatory[@]}"; do - if [[ -z "${!var:-}" ]]; then - echo "Environment variable $var must be set" - exit 1 - fi -done +if [ -z "$PKG" ] || [ -z "$ARCH" ] || [ -z "$COMMIT_SHA" ] || [ -z "$REPO_INFO" ] || [ -z "$TAG" ]; then + echo "Environments PKG, ARCH, COMMIT_SHA, REPO_INFO and TAG are required" + exit 1 +fi + export CGO_ENABLED=0 -export GOARCH=${ARCH} +export GOARCH="${ARCH}" TARGETS_DIR="rootfs/bin/${ARCH}" echo "Building targets for ${ARCH}, generated targets in ${TARGETS_DIR} directory." diff --git a/build/run-in-docker.sh b/build/run-in-docker.sh index 2eb8b5890..f44d850ea 100755 --- a/build/run-in-docker.sh +++ b/build/run-in-docker.sh @@ -76,12 +76,7 @@ fi USER=${USER:-nobody} -#echo "..printing env & other vars to stdout" -#echo "HOSTNAME=`hostname`" -#uname -a -#env -#echo "DIND_ENABLED=$DOCKER_IN_DOCKER_ENABLED" -#echo "done..printing env & other vars to stdout" +USE_SHELL=${USE_SHELL:-"/bin/bash"} if [[ "$DOCKER_IN_DOCKER_ENABLED" == "true" ]]; then echo "..reached DIND check TRUE block, inside run-in-docker.sh" @@ -100,5 +95,5 @@ else args="$args -v /var/run/docker.sock:/var/run/docker.sock" fi - ${RUNTIME} run $args ${E2E_IMAGE} /bin/bash -c "${FLAGS}" + ${RUNTIME} run $args ${E2E_IMAGE} ${USE_SHELL} -c "${FLAGS}" fi