From 7002d3c7e2f0e930dc835dbf8e897d3fc7732f33 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 14 Sep 2022 20:41:31 +0100 Subject: [PATCH 1/2] 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 5ec19205f830..b0a5d2af9ad9 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 a859eff1f2a0..de3f72d15ffa 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 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 From e4bb0de944658150409bf2dd56e68926235adcbb Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 21 Sep 2022 16:25:26 +0100 Subject: [PATCH 2/2] Update Jenkinsfile --- Jenkinsfile | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b0a5d2af9ad9..d03c0b127472 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -85,19 +85,13 @@ 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)) + withBeatsEnv(archive: false, id: "checks") { dumpVariables() whenTrue(env.ONLY_DOCS == 'false') { runChecks()