From 0704fc502b2af87c84029c6887ecb217379a5acc Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 15 Jun 2020 16:07:32 +0100 Subject: [PATCH 01/28] [CI] enable one beats for windows --- .ci/windows.groovy | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/.ci/windows.groovy b/.ci/windows.groovy index baade3dc6967..e883d7aeec75 100644 --- a/.ci/windows.groovy +++ b/.ci/windows.groovy @@ -92,7 +92,8 @@ pipeline { when { beforeAgent true expression { - return params.windowsTest + return false + // return params.windowsTest // NOTE: commented to run all the windows stages. //return env.BUILD_ELASTIC_AGENT_XPACK != "false" && params.windowsTest } @@ -106,7 +107,8 @@ pipeline { when { beforeAgent true expression { - return params.windowsTest + return false + // return params.windowsTest // NOTE: commented to run all the windows stages. //return env.BUILD_FILEBEAT != "false" && params.windowsTest } @@ -120,7 +122,8 @@ pipeline { when { beforeAgent true expression { - return params.windowsTest + return false + // return params.windowsTest // NOTE: commented to run all the windows stages. //return env.BUILD_FILEBEAT_XPACK != "false" && params.windowsTest } @@ -134,7 +137,8 @@ pipeline { when { beforeAgent true expression { - return params.windowsTest + return false + // return params.windowsTest // NOTE: commented to run all the windows stages. //return env.BUILD_HEARTBEAT != "false" } @@ -145,7 +149,8 @@ pipeline { when { beforeAgent true expression { - return params.windowsTest + return false + // return params.windowsTest } } steps { @@ -159,7 +164,8 @@ pipeline { when { beforeAgent true expression { - return params.windowsTest + return false + // return params.windowsTest // NOTE: commented to run all the windows stages. //return env.BUILD_AUDITBEAT != "false" && params.windowsTest } @@ -173,7 +179,8 @@ pipeline { when { beforeAgent true expression { - return params.windowsTest + return false + // return params.windowsTest // NOTE: commented to run all the windows stages. //return env.BUILD_AUDITBEAT_XPACK != "false" && params.windowsTest } @@ -187,7 +194,8 @@ pipeline { when { beforeAgent true expression { - return params.windowsTest + return false + // return params.windowsTest // NOTE: commented to run all the windows stages. //return env.BUILD_METRICBEAT != "false" && params.windowsTest } @@ -201,7 +209,8 @@ pipeline { when { beforeAgent true expression { - return params.windowsTest + return false + // return params.windowsTest // NOTE: commented to run all the windows stages. //return env.BUILD_METRICBEAT_XPACK != "false" && params.windowsTest } @@ -215,7 +224,8 @@ pipeline { when { beforeAgent true expression { - return params.windowsTest + return false + // return params.windowsTest // NOTE: commented to run all the windows stages. //return env.BUILD_WINLOGBEAT != "false" } @@ -226,7 +236,8 @@ pipeline { when { beforeAgent true expression { - return params.windowsTest + return false + // return params.windowsTest } } steps { @@ -240,7 +251,8 @@ pipeline { when { beforeAgent true expression { - return params.windowsTest + return false + // return params.windowsTest // NOTE: commented to run all the windows stages. //return params.windowsTest && env.BUILD_WINLOGBEAT_XPACK != "false" } From 40b96b2febb7d2787d7c465bded9eae24f74b246 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 15 Jun 2020 16:10:31 +0100 Subject: [PATCH 02/28] this is required to set the GO_VERSION --- .ci/windows.groovy | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.ci/windows.groovy b/.ci/windows.groovy index e883d7aeec75..d5bdce5dfadd 100644 --- a/.ci/windows.groovy +++ b/.ci/windows.groovy @@ -66,9 +66,7 @@ pipeline { gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: true) stashV2(name: 'source', bucket: "${JOB_GCS_BUCKET}", credentialsId: "${JOB_GCS_CREDENTIALS}") dir("${BASE_DIR}"){ - // NOTE: commented to run faster the windows pipeline. - // when required then it can be enabled. - // loadConfigEnvVars() + loadConfigEnvVars() } whenTrue(params.debug){ dumpFilteredEnvironment() From d901d22dd26b771fb7ff1a3e5a33b01f07fccf1b Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 15 Jun 2020 17:02:58 +0100 Subject: [PATCH 03/28] support one stage --- .ci/windows.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.ci/windows.groovy b/.ci/windows.groovy index d5bdce5dfadd..cc7fffd90a14 100644 --- a/.ci/windows.groovy +++ b/.ci/windows.groovy @@ -264,7 +264,9 @@ pipeline { when { beforeAgent true expression { - return env.BUILD_FUNCTIONBEAT_XPACK != "false" + return params.windowsTest + // NOTE: commented to run all the windows stages. + //return env.BUILD_FUNCTIONBEAT_XPACK != "false" } } stages { From f1715e72f075ed6ea3aed4c82f02bb2d03dbe473 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 16 Jun 2020 11:20:58 +0100 Subject: [PATCH 04/28] chore: for testing purposes --- .ci/windows.groovy | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.ci/windows.groovy b/.ci/windows.groovy index cc7fffd90a14..e8b8dceab701 100644 --- a/.ci/windows.groovy +++ b/.ci/windows.groovy @@ -1,6 +1,6 @@ #!/usr/bin/env groovy -@Library('apm@current') _ +@Library('apm@test/7z-fallback') _ import groovy.transform.Field @@ -353,12 +353,25 @@ def mageTargetWin(String context, String directory, String target) { } } +def compressToolsDetails() { + bat(label: "isTarInstalled", script: 'tar --version >NULL', returnStatus: true) + withEnv(["PATH+SYSTEM=C:\\Windows\\System32"]) { + bat(label: 'isTarInstalled withEnv', script: 'tar --version >NULL', returnStatus: true) + } + bat(label: 'is7zInstalled', script: '7z >NULL', returnStatus: true) + withEnv(["PATH+CHOCO=C:\\ProgramData\\chocolatey\\bin"]) { + bat(label: 'is7zInstalled withEnv', script: '7z >NULL', returnStatus: true) + } +} + def mageTargetWin(String context, String directory, String target, String label) { return { log(level: 'INFO', text: "context=${context} directory=${directory} target=${target} os=${label}") def immutable = label.equals('windows-7-32-bit') ? 'windows-immutable-32-bit' : 'windows-immutable' node("${immutable} && ${label}"){ withBeatsEnvWin() { + // Only for the time being + compressToolsDetails() whenTrue(params.debug) { dumpFilteredEnvironment() dumpMageWin() From 260c0bdfcf7776c4ee773ee3b2e7987ba703d862 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 16 Jun 2020 16:39:45 +0100 Subject: [PATCH 05/28] install gvm 32 bits if required --- .ci/scripts/install-tools.bat | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.ci/scripts/install-tools.bat b/.ci/scripts/install-tools.bat index d5d48b1dcd0d..3a2fc93f84f2 100644 --- a/.ci/scripts/install-tools.bat +++ b/.ci/scripts/install-tools.bat @@ -7,9 +7,19 @@ IF ERRORLEVEL 1 ( choco install curl -y --no-progress --skipdownloadcache ) mkdir %WORKSPACE%\bin + +REM If 32 bits then install the GVM accordingly +IF NOT EXIST "%PROGRAMFILES(X86)%" ( + curl -sL -o %WORKSPACE%\bin\gvm.exe https://github.com/andrewkroh/gvm/releases/download/v0.2.2/gvm-windows-386.exe +) + where /q gvm IF ERRORLEVEL 1 ( - curl -sL -o %WORKSPACE%\bin\gvm.exe https://github.com/andrewkroh/gvm/releases/download/v0.2.2/gvm-windows-amd64.exe + IF EXIST "%PROGRAMFILES(X86)%" ( + curl -sL -o %WORKSPACE%\bin\gvm.exe https://github.com/andrewkroh/gvm/releases/download/v0.2.2/gvm-windows-amd64.exe + ) ELSE ( + curl -sL -o %WORKSPACE%\bin\gvm.exe https://github.com/andrewkroh/gvm/releases/download/v0.2.2/gvm-windows-386.exe + ) ) FOR /f "tokens=*" %%i IN ('"gvm.exe" use %GO_VERSION% --format=batch') DO %%i @@ -18,6 +28,7 @@ go install -mod=vendor github.com/magefile/mage mage -version where mage + if not exist C:\Python38\python.exe ( REM Install python 3.8. choco install python -y -r --no-progress --version 3.8.2 || echo ERROR && exit /b From 78daec718200bf4b7ff557151f87a2a883e3d643 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 16 Jun 2020 16:40:22 +0100 Subject: [PATCH 06/28] Revert "chore: for testing purposes" This reverts commit f1715e72f075ed6ea3aed4c82f02bb2d03dbe473. --- .ci/windows.groovy | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/.ci/windows.groovy b/.ci/windows.groovy index e8b8dceab701..cc7fffd90a14 100644 --- a/.ci/windows.groovy +++ b/.ci/windows.groovy @@ -1,6 +1,6 @@ #!/usr/bin/env groovy -@Library('apm@test/7z-fallback') _ +@Library('apm@current') _ import groovy.transform.Field @@ -353,25 +353,12 @@ def mageTargetWin(String context, String directory, String target) { } } -def compressToolsDetails() { - bat(label: "isTarInstalled", script: 'tar --version >NULL', returnStatus: true) - withEnv(["PATH+SYSTEM=C:\\Windows\\System32"]) { - bat(label: 'isTarInstalled withEnv', script: 'tar --version >NULL', returnStatus: true) - } - bat(label: 'is7zInstalled', script: '7z >NULL', returnStatus: true) - withEnv(["PATH+CHOCO=C:\\ProgramData\\chocolatey\\bin"]) { - bat(label: 'is7zInstalled withEnv', script: '7z >NULL', returnStatus: true) - } -} - def mageTargetWin(String context, String directory, String target, String label) { return { log(level: 'INFO', text: "context=${context} directory=${directory} target=${target} os=${label}") def immutable = label.equals('windows-7-32-bit') ? 'windows-immutable-32-bit' : 'windows-immutable' node("${immutable} && ${label}"){ withBeatsEnvWin() { - // Only for the time being - compressToolsDetails() whenTrue(params.debug) { dumpFilteredEnvironment() dumpMageWin() From d4788d669f119517fdb3bdc600e5e42ae06ada58 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 16 Jun 2020 16:41:05 +0100 Subject: [PATCH 07/28] chore: for testing purposes --- .ci/windows.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/windows.groovy b/.ci/windows.groovy index cc7fffd90a14..4e792233403c 100644 --- a/.ci/windows.groovy +++ b/.ci/windows.groovy @@ -1,6 +1,6 @@ #!/usr/bin/env groovy -@Library('apm@current') _ +@Library('apm@test/7z-fallback') _ import groovy.transform.Field From ed3874bdce5201a25d2e7172ecd072f0659a71a0 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 16 Jun 2020 16:43:12 +0100 Subject: [PATCH 08/28] chore: cosmetic change --- .ci/scripts/install-tools.bat | 1 - 1 file changed, 1 deletion(-) diff --git a/.ci/scripts/install-tools.bat b/.ci/scripts/install-tools.bat index 3a2fc93f84f2..4c601664708e 100644 --- a/.ci/scripts/install-tools.bat +++ b/.ci/scripts/install-tools.bat @@ -28,7 +28,6 @@ go install -mod=vendor github.com/magefile/mage mage -version where mage - if not exist C:\Python38\python.exe ( REM Install python 3.8. choco install python -y -r --no-progress --version 3.8.2 || echo ERROR && exit /b From 538ede03a7d8b7e8ab2b67651fcc660253111afb Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 17 Jun 2020 08:16:02 +0100 Subject: [PATCH 09/28] ci: support 32 bits for gvm --- Jenkinsfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d282f711807a..edff446e1cf8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -929,7 +929,9 @@ def withBeatsEnvWin(Map args = [:], Closure body) { } final String chocoPath = 'C:\\ProgramData\\chocolatey\\bin' final String chocoPython3Path = 'C:\\Python38;C:\\Python38\\Scripts' - def goRoot = "${env.USERPROFILE}\\.gvm\\versions\\go${GO_VERSION}.windows.amd64" + // NOTE: to support Windows 7 32 bits the arch in the go context path is required + def arch = is32bit() ? '386' : 'amd64' + def goRoot = "${env.USERPROFILE}\\.gvm\\versions\\go${GO_VERSION}.windows.${arch}" deleteDir() unstashV2(name: 'source', bucket: "${JOB_GCS_BUCKET}", credentialsId: "${JOB_GCS_CREDENTIALS}") @@ -975,6 +977,11 @@ def installTools() { } } +def is32bit(){ + def labels = env.NODE_LABELS + return labels.contains('i386') +} + def goos(){ def labels = env.NODE_LABELS From bcaf8b035398efe752b2085ba2bb08a5e2b05689 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 17 Jun 2020 09:15:29 +0100 Subject: [PATCH 10/28] Revert "ci: support 32 bits for gvm" This reverts commit 538ede03a7d8b7e8ab2b67651fcc660253111afb. --- Jenkinsfile | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index edff446e1cf8..d282f711807a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -929,9 +929,7 @@ def withBeatsEnvWin(Map args = [:], Closure body) { } final String chocoPath = 'C:\\ProgramData\\chocolatey\\bin' final String chocoPython3Path = 'C:\\Python38;C:\\Python38\\Scripts' - // NOTE: to support Windows 7 32 bits the arch in the go context path is required - def arch = is32bit() ? '386' : 'amd64' - def goRoot = "${env.USERPROFILE}\\.gvm\\versions\\go${GO_VERSION}.windows.${arch}" + def goRoot = "${env.USERPROFILE}\\.gvm\\versions\\go${GO_VERSION}.windows.amd64" deleteDir() unstashV2(name: 'source', bucket: "${JOB_GCS_BUCKET}", credentialsId: "${JOB_GCS_CREDENTIALS}") @@ -977,11 +975,6 @@ def installTools() { } } -def is32bit(){ - def labels = env.NODE_LABELS - return labels.contains('i386') -} - def goos(){ def labels = env.NODE_LABELS From c0091495cfe97dc94179a7ad11505d9d6af68aa2 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 17 Jun 2020 09:16:16 +0100 Subject: [PATCH 11/28] ci: support 32 bits for gvm --- .ci/windows.groovy | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.ci/windows.groovy b/.ci/windows.groovy index 4e792233403c..93841e481451 100644 --- a/.ci/windows.groovy +++ b/.ci/windows.groovy @@ -419,7 +419,9 @@ def withBeatsEnv(boolean archive, Closure body) { def withBeatsEnvWin(Closure body) { final String chocoPath = 'C:\\ProgramData\\chocolatey\\bin' final String chocoPython3Path = 'C:\\Python38;C:\\Python38\\Scripts' - def goRoot = "${env.USERPROFILE}\\.gvm\\versions\\go${GO_VERSION}.windows.amd64" + // NOTE: to support Windows 7 32 bits the arch in the go context path is required In order to support + def arch = is32bit() ? '386' : 'amd64' + def goRoot = "${env.USERPROFILE}\\.gvm\\versions\\go${GO_VERSION}.windows.${arch}" withEnv([ "HOME=${env.WORKSPACE}", @@ -460,6 +462,11 @@ def installTools() { } } +def is32bit(){ + def labels = env.NODE_LABELS + return labels.contains('i386') +} + def goos(){ def labels = env.NODE_LABELS From 8d8bba826f9c5f25706b07ea852a16db237a370d Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 17 Jun 2020 10:16:06 +0100 Subject: [PATCH 12/28] amd64 GOARCH and --race only on amd64 --- .ci/windows.groovy | 3 ++- dev-tools/mage/gotest.go | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.ci/windows.groovy b/.ci/windows.groovy index 93841e481451..13201079b887 100644 --- a/.ci/windows.groovy +++ b/.ci/windows.groovy @@ -419,12 +419,13 @@ def withBeatsEnv(boolean archive, Closure body) { def withBeatsEnvWin(Closure body) { final String chocoPath = 'C:\\ProgramData\\chocolatey\\bin' final String chocoPython3Path = 'C:\\Python38;C:\\Python38\\Scripts' - // NOTE: to support Windows 7 32 bits the arch in the go context path is required In order to support + // NOTE: to support Windows 7 32 bits the arch in the go context path is required. def arch = is32bit() ? '386' : 'amd64' def goRoot = "${env.USERPROFILE}\\.gvm\\versions\\go${GO_VERSION}.windows.${arch}" withEnv([ "HOME=${env.WORKSPACE}", + "DEV_ARCH=${arch}", "GOPATH=${env.WORKSPACE}", "GOROOT=${goRoot}", "PATH=${env.WORKSPACE}\\bin;${goRoot}\\bin;${chocoPath};${chocoPython3Path};${env.PATH}", diff --git a/dev-tools/mage/gotest.go b/dev-tools/mage/gotest.go index c813693971e6..948d15c754fd 100644 --- a/dev-tools/mage/gotest.go +++ b/dev-tools/mage/gotest.go @@ -193,8 +193,11 @@ func GoTest(ctx context.Context, params GoTestArgs) error { args := []string{"test"} args = append(args, "-v") - if params.Race { - args = append(args, "-race") + // -race is only supported on */amd64 + if os.Getenv("DEV_ARCH") == "amd64" { + if params.Race { + args = append(args, "-race") + } } if len(params.Tags) > 0 { args = append(args, "-tags", strings.Join(params.Tags, " ")) From 648362de36f13c6f5b46c3d2f1b27e62d3a6f088 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 17 Jun 2020 10:28:26 +0100 Subject: [PATCH 13/28] DEV_OS=windows --- .ci/windows.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/windows.groovy b/.ci/windows.groovy index 13201079b887..001b84fd8cd7 100644 --- a/.ci/windows.groovy +++ b/.ci/windows.groovy @@ -426,6 +426,7 @@ def withBeatsEnvWin(Closure body) { withEnv([ "HOME=${env.WORKSPACE}", "DEV_ARCH=${arch}", + "DEV_OS=windows", "GOPATH=${env.WORKSPACE}", "GOROOT=${goRoot}", "PATH=${env.WORKSPACE}\\bin;${goRoot}\\bin;${chocoPath};${chocoPython3Path};${env.PATH}", From ac237dda6a68f9b1fb487d48a5842d94ff0050b2 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 17 Jun 2020 10:50:34 +0100 Subject: [PATCH 14/28] Revert "chore: for testing purposes" This reverts commit d4788d669f119517fdb3bdc600e5e42ae06ada58. --- .ci/windows.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/windows.groovy b/.ci/windows.groovy index 001b84fd8cd7..3369c056e982 100644 --- a/.ci/windows.groovy +++ b/.ci/windows.groovy @@ -1,6 +1,6 @@ #!/usr/bin/env groovy -@Library('apm@test/7z-fallback') _ +@Library('apm@current') _ import groovy.transform.Field From fdfffe100ea0c10a8de7b2824a0ae31bfbd47c8b Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 17 Jun 2020 11:14:31 +0100 Subject: [PATCH 15/28] x-pack/elastic-agent --- .ci/windows.groovy | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.ci/windows.groovy b/.ci/windows.groovy index 3369c056e982..5fd5cd155506 100644 --- a/.ci/windows.groovy +++ b/.ci/windows.groovy @@ -90,8 +90,7 @@ pipeline { when { beforeAgent true expression { - return false - // return params.windowsTest + return params.windowsTest // NOTE: commented to run all the windows stages. //return env.BUILD_ELASTIC_AGENT_XPACK != "false" && params.windowsTest } @@ -276,7 +275,9 @@ pipeline { when { beforeAgent true expression { - return params.windowsTest + return false + // NOTE: commented to run all the windows stages. + // return params.windowsTest } } steps { From ce6ce423f6b575aed6a955a3fa72b5462753e453 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 17 Jun 2020 11:14:46 +0100 Subject: [PATCH 16/28] unrequired --- .ci/windows.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/.ci/windows.groovy b/.ci/windows.groovy index 5fd5cd155506..c555a9362700 100644 --- a/.ci/windows.groovy +++ b/.ci/windows.groovy @@ -270,7 +270,6 @@ pipeline { } stages { stage('Functionbeat Windows'){ - agent { label 'windows-immutable && windows-2019' } options { skipDefaultCheckout() } when { beforeAgent true From dcb6801b6a279614295c98ae2bf4100b72dddb49 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 17 Jun 2020 11:35:04 +0100 Subject: [PATCH 17/28] amd64 GOARCH and --race only on amd64 --- x-pack/elastic-agent/magefile.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/x-pack/elastic-agent/magefile.go b/x-pack/elastic-agent/magefile.go index e7397d03c6a6..ff1c59a92be9 100644 --- a/x-pack/elastic-agent/magefile.go +++ b/x-pack/elastic-agent/magefile.go @@ -234,7 +234,11 @@ func (Test) All() { // Unit runs all the unit tests. func (Test) Unit() error { mg.Deps(Prepare.Env, Build.TestBinaries) - return RunGo("test", "-race", "-v", "-coverprofile", filepath.Join(buildDir, "coverage.out"), "./...") + raceFlag = "" + if os.Getenv("DEV_ARCH") == "amd64" { + args = "-race" + } + return RunGo("test", raceFlag, "-v", "-coverprofile", filepath.Join(buildDir, "coverage.out"), "./...") } // Coverage takes the coverages report from running all the tests and display the results in the browser. From 0e3a1f14c29dc6df8ceee39510e99c300f97a5d0 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 17 Jun 2020 11:43:52 +0100 Subject: [PATCH 18/28] gcc is not available in the w2012-r2 workers, let's disable it for the time being --- .ci/windows.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.ci/windows.groovy b/.ci/windows.groovy index c555a9362700..70697d21bfad 100644 --- a/.ci/windows.groovy +++ b/.ci/windows.groovy @@ -11,8 +11,9 @@ import groovy.transform.Field /** List of supported windows versions to be tested with + NOTE: 'windows-2012-r2' is not supported until gcc got installed. */ -@Field def windowsVersions = ['windows-2019', 'windows-2016', 'windows-2012-r2', 'windows-10', 'windows-2008-r2', 'windows-7', 'windows-7-32-bit'] +@Field def windowsVersions = ['windows-2019', 'windows-2016', 'windows-10', 'windows-2008-r2', 'windows-7', 'windows-7-32-bit'] pipeline { agent { label 'ubuntu && immutable' } From f6803b118a0aa99367808c618a12c7fa2955e0df Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 17 Jun 2020 11:48:47 +0100 Subject: [PATCH 19/28] enable all the remaining stages --- .ci/windows.groovy | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/.ci/windows.groovy b/.ci/windows.groovy index 70697d21bfad..bdbc9cfe4dc9 100644 --- a/.ci/windows.groovy +++ b/.ci/windows.groovy @@ -105,8 +105,7 @@ pipeline { when { beforeAgent true expression { - return false - // return params.windowsTest + return params.windowsTest // NOTE: commented to run all the windows stages. //return env.BUILD_FILEBEAT != "false" && params.windowsTest } @@ -120,8 +119,7 @@ pipeline { when { beforeAgent true expression { - return false - // return params.windowsTest + return params.windowsTest // NOTE: commented to run all the windows stages. //return env.BUILD_FILEBEAT_XPACK != "false" && params.windowsTest } @@ -135,8 +133,7 @@ pipeline { when { beforeAgent true expression { - return false - // return params.windowsTest + return params.windowsTest // NOTE: commented to run all the windows stages. //return env.BUILD_HEARTBEAT != "false" } @@ -147,8 +144,7 @@ pipeline { when { beforeAgent true expression { - return false - // return params.windowsTest + return params.windowsTest } } steps { @@ -162,8 +158,7 @@ pipeline { when { beforeAgent true expression { - return false - // return params.windowsTest + return params.windowsTest // NOTE: commented to run all the windows stages. //return env.BUILD_AUDITBEAT != "false" && params.windowsTest } @@ -177,8 +172,7 @@ pipeline { when { beforeAgent true expression { - return false - // return params.windowsTest + return params.windowsTest // NOTE: commented to run all the windows stages. //return env.BUILD_AUDITBEAT_XPACK != "false" && params.windowsTest } @@ -192,8 +186,7 @@ pipeline { when { beforeAgent true expression { - return false - // return params.windowsTest + return params.windowsTest // NOTE: commented to run all the windows stages. //return env.BUILD_METRICBEAT != "false" && params.windowsTest } @@ -207,8 +200,7 @@ pipeline { when { beforeAgent true expression { - return false - // return params.windowsTest + return params.windowsTest // NOTE: commented to run all the windows stages. //return env.BUILD_METRICBEAT_XPACK != "false" && params.windowsTest } @@ -222,8 +214,7 @@ pipeline { when { beforeAgent true expression { - return false - // return params.windowsTest + return params.windowsTest // NOTE: commented to run all the windows stages. //return env.BUILD_WINLOGBEAT != "false" } @@ -234,8 +225,7 @@ pipeline { when { beforeAgent true expression { - return false - // return params.windowsTest + return params.windowsTest } } steps { @@ -249,8 +239,7 @@ pipeline { when { beforeAgent true expression { - return false - // return params.windowsTest + return params.windowsTest // NOTE: commented to run all the windows stages. //return params.windowsTest && env.BUILD_WINLOGBEAT_XPACK != "false" } From f1d23909d47a642bb0b9f3694e2b0a89b31d9b82 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 17 Jun 2020 12:16:48 +0100 Subject: [PATCH 20/28] fix typo --- x-pack/elastic-agent/magefile.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/elastic-agent/magefile.go b/x-pack/elastic-agent/magefile.go index ff1c59a92be9..613490b1241f 100644 --- a/x-pack/elastic-agent/magefile.go +++ b/x-pack/elastic-agent/magefile.go @@ -234,9 +234,9 @@ func (Test) All() { // Unit runs all the unit tests. func (Test) Unit() error { mg.Deps(Prepare.Env, Build.TestBinaries) - raceFlag = "" + raceFlag := "" if os.Getenv("DEV_ARCH") == "amd64" { - args = "-race" + raceFlag = "-race" } return RunGo("test", raceFlag, "-v", "-coverprofile", filepath.Join(buildDir, "coverage.out"), "./...") } From 20160f8ae5262ed4fd95a2a6ecbb84b62bfd886e Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 17 Jun 2020 14:18:16 +0100 Subject: [PATCH 21/28] Unique ID --- .ci/windows.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/windows.groovy b/.ci/windows.groovy index bdbc9cfe4dc9..3e8ca801861c 100644 --- a/.ci/windows.groovy +++ b/.ci/windows.groovy @@ -245,7 +245,7 @@ pipeline { } } steps { - mageTargetWin("Winlogbeat Windows Unit test", "x-pack/winlogbeat", "build unitTest") + mageTargetWin("Winlogbeat x-pack Windows", "x-pack/winlogbeat", "build unitTest") } } stage('Functionbeat'){ From e765547b2591e9526c0b61f4f298edcdad5e5e63 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 17 Jun 2020 14:21:19 +0100 Subject: [PATCH 22/28] ci: disable w10 and enable Functionbeat --- .ci/windows.groovy | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.ci/windows.groovy b/.ci/windows.groovy index 3e8ca801861c..b51e2f171c35 100644 --- a/.ci/windows.groovy +++ b/.ci/windows.groovy @@ -11,9 +11,11 @@ import groovy.transform.Field /** List of supported windows versions to be tested with - NOTE: 'windows-2012-r2' is not supported until gcc got installed. + NOTE: + - 'windows-2012-r2' is not supported until gcc got installed. + - 'windows-10' is too slow */ -@Field def windowsVersions = ['windows-2019', 'windows-2016', 'windows-10', 'windows-2008-r2', 'windows-7', 'windows-7-32-bit'] +@Field def windowsVersions = ['windows-2019', 'windows-2016', 'windows-2008-r2', 'windows-7', 'windows-7-32-bit'] pipeline { agent { label 'ubuntu && immutable' } @@ -259,18 +261,16 @@ pipeline { } } stages { - stage('Functionbeat Windows'){ + stage('Functionbeat Windows x-pack'){ options { skipDefaultCheckout() } when { beforeAgent true expression { - return false - // NOTE: commented to run all the windows stages. - // return params.windowsTest + return params.windowsTest } } steps { - mageTargetWin("Functionbeat Windows Unit test", "x-pack/functionbeat", "build unitTest") + mageTargetWin("Functionbeat x-pack Windows Unit test", "x-pack/functionbeat", "build unitTest") } } } From 32ae6bfa3400d12726720a479a895052f4953f79 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 17 Jun 2020 14:38:43 +0100 Subject: [PATCH 23/28] gcc installation --- .ci/scripts/install-tools.bat | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.ci/scripts/install-tools.bat b/.ci/scripts/install-tools.bat index 4c601664708e..ca0b1ce9c41f 100644 --- a/.ci/scripts/install-tools.bat +++ b/.ci/scripts/install-tools.bat @@ -35,3 +35,9 @@ if not exist C:\Python38\python.exe ( python --version where python +if not exist C:\tools\mingw64\bin\gcc.exe ( + REM Install mingw 5.3.0 + choco install mingw -y -r --no-progress --version 5.3.0 || echo ERROR && exit /b +) + +where gcc --version From e05cdb9203a19cc1ecdeec25c6626942018bc7d7 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 17 Jun 2020 14:39:39 +0100 Subject: [PATCH 24/28] enable windows-2012-r2 to validate the gcc instalation --- .ci/windows.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.ci/windows.groovy b/.ci/windows.groovy index b51e2f171c35..6b7c891c35b5 100644 --- a/.ci/windows.groovy +++ b/.ci/windows.groovy @@ -12,10 +12,9 @@ import groovy.transform.Field /** List of supported windows versions to be tested with NOTE: - - 'windows-2012-r2' is not supported until gcc got installed. - 'windows-10' is too slow */ -@Field def windowsVersions = ['windows-2019', 'windows-2016', 'windows-2008-r2', 'windows-7', 'windows-7-32-bit'] +@Field def windowsVersions = ['windows-2019', 'windows-2016', 'windows-2012-r2', 'windows-2008-r2', 'windows-7', 'windows-7-32-bit'] pipeline { agent { label 'ubuntu && immutable' } From 44f3b838b04353ab72b0072a5fbd4d27f67ad7e6 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 17 Jun 2020 16:32:37 +0100 Subject: [PATCH 25/28] fix gcc validations --- .ci/scripts/install-tools.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/scripts/install-tools.bat b/.ci/scripts/install-tools.bat index ca0b1ce9c41f..91eaf4000698 100644 --- a/.ci/scripts/install-tools.bat +++ b/.ci/scripts/install-tools.bat @@ -39,5 +39,5 @@ if not exist C:\tools\mingw64\bin\gcc.exe ( REM Install mingw 5.3.0 choco install mingw -y -r --no-progress --version 5.3.0 || echo ERROR && exit /b ) - -where gcc --version +gcc --version +where gcc From 802a6227e478c73ae3dd3f46f6726dccd0183dfe Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 17 Jun 2020 17:01:31 +0100 Subject: [PATCH 26/28] Add gcc to the path --- .ci/scripts/install-tools.bat | 2 +- .ci/windows.groovy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/scripts/install-tools.bat b/.ci/scripts/install-tools.bat index 91eaf4000698..0950dd3f3375 100644 --- a/.ci/scripts/install-tools.bat +++ b/.ci/scripts/install-tools.bat @@ -1,6 +1,6 @@ set GOPATH=%WORKSPACE% set MAGEFILE_CACHE=%WORKSPACE%\.magefile -set PATH=%WORKSPACE%\bin;C:\ProgramData\chocolatey\bin;%PATH% +set PATH=%WORKSPACE%\bin;C:\ProgramData\chocolatey\bin;C:\tools\mingw64\bin;%PATH% where /q curl IF ERRORLEVEL 1 ( diff --git a/.ci/windows.groovy b/.ci/windows.groovy index 6b7c891c35b5..8786115c5d5f 100644 --- a/.ci/windows.groovy +++ b/.ci/windows.groovy @@ -418,7 +418,7 @@ def withBeatsEnvWin(Closure body) { "DEV_OS=windows", "GOPATH=${env.WORKSPACE}", "GOROOT=${goRoot}", - "PATH=${env.WORKSPACE}\\bin;${goRoot}\\bin;${chocoPath};${chocoPython3Path};${env.PATH}", + "PATH=${env.WORKSPACE}\\bin;${goRoot}\\bin;${chocoPath};${chocoPython3Path};C:\\tools\\mingw64\\bin;${env.PATH}", "MAGEFILE_CACHE=${env.WORKSPACE}\\.magefile", "TEST_COVERAGE=true", "RACE_DETECTOR=true", From d74b1b7c1283da70382d59c18e47e887fff4c6ee Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 17 Jun 2020 17:03:23 +0100 Subject: [PATCH 27/28] Subset of supported versions until we make them to work --- .ci/windows.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.ci/windows.groovy b/.ci/windows.groovy index 8786115c5d5f..66030875e7d4 100644 --- a/.ci/windows.groovy +++ b/.ci/windows.groovy @@ -13,8 +13,10 @@ import groovy.transform.Field List of supported windows versions to be tested with NOTE: - 'windows-10' is too slow + - 'windows-2012-r2', 'windows-2008-r2', 'windows-7', 'windows-7-32-bit' are disabled + since we are working on releasing each windows version incrementally. */ -@Field def windowsVersions = ['windows-2019', 'windows-2016', 'windows-2012-r2', 'windows-2008-r2', 'windows-7', 'windows-7-32-bit'] +@Field def windowsVersions = ['windows-2019', 'windows-2016'] pipeline { agent { label 'ubuntu && immutable' } From 1ee8f705afaccdbaaad2208cc0b6bbec8dc89025 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 2 Jul 2020 10:41:32 +0100 Subject: [PATCH 28/28] ci: skip filebeat for windows-2016 since there are test failures more verbose output --- .ci/windows.groovy | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/.ci/windows.groovy b/.ci/windows.groovy index 66030875e7d4..1fca67e337fd 100644 --- a/.ci/windows.groovy +++ b/.ci/windows.groovy @@ -348,16 +348,22 @@ def mageTargetWin(String context, String directory, String target, String label) return { log(level: 'INFO', text: "context=${context} directory=${directory} target=${target} os=${label}") def immutable = label.equals('windows-7-32-bit') ? 'windows-immutable-32-bit' : 'windows-immutable' - node("${immutable} && ${label}"){ - withBeatsEnvWin() { - whenTrue(params.debug) { - dumpFilteredEnvironment() - dumpMageWin() - } - def verboseFlag = params.debug ? "-v" : "" - dir(directory) { - bat(label: "Mage ${target}", script: "mage ${verboseFlag} ${target}") + // NOTE: skip filebeat with windows-2016 since there are some test failures. + if (directory.equals('filebeat') && label.equals('windows-2016')) { + log(level: 'WARN', text: "Skipped stage for the 'filebeat' with 'windows-2016' as long as there are test failures to be analysed.") + } else { + node("${immutable} && ${label}"){ + withBeatsEnvWin() { + whenTrue(params.debug) { + dumpFilteredEnvironment() + dumpMageWin() + } + + def verboseFlag = params.debug ? "-v" : "" + dir(directory) { + bat(label: "Mage ${target}", script: "mage ${verboseFlag} ${target}") + } } } }