Skip to content

Commit 2f2f429

Browse files
Cleanup various code smells withing Makefile ands supporting scripts (#4326)
Remove arch 386 targets Rename docker build image to avoid confusion group docker vars fix gvm install on non linux/amd64 hosts remove unused common.sh funcs
1 parent 3f298bc commit 2f2f429

File tree

4 files changed

+8
-47
lines changed

4 files changed

+8
-47
lines changed

.buildkite/scripts/release-manager.sh

-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
# - VAULT_ROLE_ID
1313
# - VAULT_SECRET_ID
1414
#
15-
# It uses env variables to help to run this script with a simpler jenkins
16-
# pipeline call.
17-
#
1815

1916
source .buildkite/scripts/common.sh
2017

.buildkite/scripts/test-release.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -euo pipefail
44

55
FLEET_SERVER_VERSION=${1:?"Fleet Server version is needed"}
66

7-
PLATFORM_FILES=(darwin-aarch64.tar.gz darwin-x86_64.tar.gz linux-arm64.tar.gz linux-x86_64.tar.gz linux-x86.tar.gz windows-x86_64.zip windows-x86.zip)
7+
PLATFORM_FILES=(darwin-aarch64.tar.gz darwin-x86_64.tar.gz linux-arm64.tar.gz linux-x86_64.tar.gz windows-x86_64.zip)
88

99
#make release
1010

Makefile

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
SHELL=/usr/bin/env bash
22
GO_VERSION=$(shell cat '.go-version')
33
DEFAULT_VERSION=$(shell awk '/const DefaultVersion/{print $$NF}' version/version.go | tr -d '"')
4-
TARGET_ARCH_386=x86
54
TARGET_ARCH_amd64=x86_64
65
TARGET_ARCH_arm64=arm64
7-
PLATFORMS ?= darwin/amd64 darwin/arm64 linux/386 linux/amd64 linux/arm64 windows/386 windows/amd64
8-
DOCKER_PLATFORMS ?= linux/amd64 linux/arm64
6+
PLATFORMS ?= darwin/amd64 darwin/arm64 linux/amd64 linux/arm64 windows/amd64
97
BUILDMODE_linux_amd64=-buildmode=pie
108
BUILDMODE_linux_arm64=-buildmode=pie
11-
BUILDMODE_windows_386=-buildmode=pie
129
BUILDMODE_windows_amd64=-buildmode=pie
1310
BUILDMODE_darwin_amd64=-buildmode=pie
1411
BUILDMODE_darwin_arm64=-buildmode=pie
1512

1613
CROSSBUILD_SUFFIX=main-debian11
17-
BUILDER_IMAGE=docker.elastic.co/beats-dev/golang-crossbuild:${GO_VERSION}-${CROSSBUILD_SUFFIX}
14+
BUILDER_IMAGE=fleet-server-builder:${GO_VERSION}
1815

1916
#Benchmark related targets
2017
BENCH_BASE ?= benchmark-$(COMMIT).out
@@ -41,6 +38,7 @@ else
4138
VERSION=${DEFAULT_VERSION}
4239
endif
4340

41+
DOCKER_PLATFORMS ?= linux/amd64 linux/arm64
4442
DOCKER_IMAGE_TAG?=${VERSION}
4543
DOCKER_IMAGE?=docker.elastic.co/fleet-server/fleet-server
4644

dev-tools/common.bash

+4-38
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,15 @@ get_go_version() {
3535
}
3636

3737
# install_gvm
38-
# Install gvm to /usr/local/bin.
38+
# Install gvm to GOPATH
3939
# To read more about installing gvm in other platforms: https://github.com/andrewkroh/gvm#installation
4040
install_gvm() {
4141
# Install gvm
42-
if [ ! -f "/usr/local/bin/gvm" ]; then
43-
curl -sL -o ~/bin/gvm https://github.com/andrewkroh/gvm/releases/download/v0.3.0/gvm-linux-amd64
44-
chmod +x /usr/local/bin/gvm
42+
if [ ! -f "$(go env GOPATH)/bin/gvm" ]; then
43+
go install github.com/andrewkroh/gvm/cmd/[email protected]
4544
fi
4645

47-
GVM="/usr/local/bin/gvm"
46+
GVM="$(go env GOPATH)/bin/gvm"
4847
debug "Gvm version $(${GVM} --version)"
4948
}
5049

@@ -77,36 +76,3 @@ setup_go_path() {
7776

7877
debug "GOPATH=${GOPATH}"
7978
}
80-
81-
jenkins_setup() {
82-
: "${HOME:?Need to set HOME to a non-empty value.}"
83-
: "${WORKSPACE:?Need to set WORKSPACE to a non-empty value.}"
84-
85-
if [ -z ${GO_VERSION:-} ]; then
86-
get_go_version
87-
fi
88-
89-
# Setup Go.
90-
export GOPATH=${WORKSPACE}
91-
export PATH=${GOPATH}/bin:${PATH}
92-
eval "$(gvm ${GO_VERSION})"
93-
94-
# Workaround for Python virtualenv path being too long.
95-
export TEMP_PYTHON_ENV=$(mktemp -d)
96-
export PYTHON_ENV="${TEMP_PYTHON_ENV}/python-env"
97-
98-
# Write cached magefile binaries to workspace to ensure
99-
# each run starts from a clean slate.
100-
export MAGEFILE_CACHE="${WORKSPACE}/.magefile"
101-
}
102-
103-
docker_setup() {
104-
OS="$(uname)"
105-
case $OS in
106-
'Darwin')
107-
# Start the docker machine VM (ignore error if it's already running).
108-
docker-machine start default || true
109-
eval $(docker-machine env default)
110-
;;
111-
esac
112-
}

0 commit comments

Comments
 (0)