From 7002d3c7e2f0e930dc835dbf8e897d3fc7732f33 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 14 Sep 2022 20:41:31 +0100 Subject: [PATCH] fix: mage installation with go1.18 (#33083) * path for the mage with go1.18 has changed * ci: test the command in the CI pipeline * ci: set HOME * new make goal to validate the mage installation * unrequired path when using go install (cherry picked from commit 5385fd2387f054f27d7af28dcd77edc6e072b3b4) # Conflicts: # Jenkinsfile --- Jenkinsfile | 10 ++++++++++ Makefile | 4 ++++ dev-tools/make/mage-install.mk | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5ec19205f83..b0a5d2af9ad 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -85,9 +85,19 @@ pipeline { GOFLAGS = '-mod=readonly' } steps { +<<<<<<< HEAD withGithubNotify(context: "Checks") { stageStatusCache(id: 'Checks'){ withBeatsEnv(archive: false, id: "checks") { +======= + withGithubNotify(context: "Lint") { + stageStatusCache(id: 'Lint'){ + // test the ./dev-tools/run_with_go_ver used by the Unified Release process + dir("${BASE_DIR}") { + sh "HOME=${WORKSPACE} GO_VERSION=${GO_VERSION} ./dev-tools/run_with_go_ver make test-mage" + } + withBeatsEnv(archive: false, id: "lint") { +>>>>>>> 5385fd2387 (fix: mage installation with go1.18 (#33083)) dumpVariables() whenTrue(env.ONLY_DOCS == 'false') { runChecks() diff --git a/Makefile b/Makefile index a859eff1f2a..de3f72d15ff 100644 --- a/Makefile +++ b/Makefile @@ -235,3 +235,7 @@ beats-dashboards: mage update build/distributions/dependencies.csv: $(PYTHON) @mkdir -p build/distributions $(PYTHON) dev-tools/dependencies-report --csv $@ + +## test-mage : Test the mage installation used by the Unified Release process +test-mage: mage + @mage dumpVariables diff --git a/dev-tools/make/mage-install.mk b/dev-tools/make/mage-install.mk index 309e3fa585a..db6beb37c62 100644 --- a/dev-tools/make/mage-install.mk +++ b/dev-tools/make/mage-install.mk @@ -7,7 +7,7 @@ export MAGE_IMPORT_PATH mage: ifndef MAGE_PRESENT @echo Installing mage $(MAGE_VERSION). - @go get -ldflags="-X $(MAGE_IMPORT_PATH)/mage.gitTag=$(MAGE_VERSION)" ${MAGE_IMPORT_PATH}@$(MAGE_VERSION) + @go install -ldflags="-X $(MAGE_IMPORT_PATH)/mage.gitTag=$(MAGE_VERSION)" ${MAGE_IMPORT_PATH}@$(MAGE_VERSION) @-mage -clean endif @true