Skip to content

Commit 52f6a85

Browse files
authored
refactor: let go.mod manage mage version (#5414)
* refactor: let go.mod manage mage version drop hardcoded version and use whatever version is specified in go.mod When calling go install without an explicit version the one in go.mod is used. * lint: remove unused variables * lint: remove unused variables
1 parent 1242e71 commit 52f6a85

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

.buildkite/scripts/common.sh

-4
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ if [[ -z "${WORKSPACE-""}" ]]; then
66
WORKSPACE=$(git rev-parse --show-toplevel)
77
export WORKSPACE
88
fi
9-
if [[ -z "${SETUP_MAGE_VERSION-""}" ]]; then
10-
SETUP_MAGE_VERSION="1.15.0"
11-
fi
129
if [[ -z "${SETUP_GVM_VERSION-""}" ]]; then
1310
SETUP_GVM_VERSION="v0.5.2" # https://github.com/andrewkroh/gvm/issues/44#issuecomment-1013231151
1411
fi
@@ -54,7 +51,6 @@ mage() {
5451
go version
5552
if ! [ -x "$(type -P mage | sed 's/mage is //g')" ];
5653
then
57-
echo "installing mage ${SETUP_MAGE_VERSION}"
5854
make mage
5955
fi
6056
pushd "$WORKSPACE"

Dockerfile.skaffold

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ ARG AGENT_IMAGE="docker.elastic.co/beats/elastic-agent"
77
FROM ${crossbuild_image}:${GO_VERSION}-main-debian8 as build
88
ARG DEV="true"
99
ARG SNAPSHOT="true"
10-
RUN go install github.com/magefile/mage@v1.15.0
1110
WORKDIR /elastic-agent/
1211
COPY go.mod go.sum /elastic-agent/
1312
RUN go mod download
1413
COPY . /elastic-agent/
14+
RUN go install github.com/magefile/mage
1515
RUN mage golangcrossBuild
1616
RUN git rev-parse HEAD | cut -c 1-6 > .build_hash.txt
1717

Makefile

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ COVERAGE_DIR=$(BUILD_DIR)/coverage
33
BEATS?=elastic-agent
44
PROJECTS= $(BEATS)
55
PYTHON_ENV?=$(BUILD_DIR)/python-env
6-
MAGE_VERSION ?= v1.15.0
76
MAGE_PRESENT := $(shell mage --version 2> /dev/null | grep $(MAGE_VERSION))
87
MAGE_IMPORT_PATH ?= github.com/magefile/mage
98
export MAGE_IMPORT_PATH
@@ -12,11 +11,11 @@ export MAGE_IMPORT_PATH
1211
.PHONY: mage
1312
mage:
1413
ifndef MAGE_PRESENT
15-
@echo Installing mage $(MAGE_VERSION).
16-
@go install ${MAGE_IMPORT_PATH}@$(MAGE_VERSION)
14+
@echo Installing mage.
15+
@go install ${MAGE_IMPORT_PATH}
1716
@-mage -clean
1817
else
19-
@echo Mage $(MAGE_VERSION) already installed.
18+
@echo Mage already installed.
2019
endif
2120

2221
## help : Show this help.

0 commit comments

Comments
 (0)