From 5385fd2387f054f27d7af28dcd77edc6e072b3b4 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 --- Jenkinsfile | 4 ++++ Makefile | 4 ++++ dev-tools/make/mage-install.mk | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f923b841685c..122708b86c71 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -87,6 +87,10 @@ pipeline { steps { 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") { dumpVariables() whenTrue(env.ONLY_DOCS == 'false') { diff --git a/Makefile b/Makefile index 0426d0ca3bb1..974647a32e48 100644 --- a/Makefile +++ b/Makefile @@ -237,3 +237,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 309e3fa585a6..db6beb37c629 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