From f275cc9de4d54e362d25b8071d898fe00b0e4b86 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 20 Jul 2020 16:50:40 +0100 Subject: [PATCH 1/8] [CI] disable MacOSX by default --- Jenkinsfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9ac747fccb7..aea0855c784 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -55,12 +55,10 @@ pipeline { parameters { booleanParam(name: 'runAllStages', defaultValue: false, description: 'Allow to run all stages.') booleanParam(name: 'windowsTest', defaultValue: true, description: 'Allow Windows stages.') - booleanParam(name: 'macosTest', defaultValue: true, description: 'Allow macOS stages.') - + booleanParam(name: 'macosTest', defaultValue: false, description: 'Allow macOS stages.') booleanParam(name: 'allCloudTests', defaultValue: false, description: 'Run all cloud integration tests.') booleanParam(name: 'awsCloudTests', defaultValue: false, description: 'Run AWS cloud integration tests.') string(name: 'awsRegion', defaultValue: 'eu-central-1', description: 'Default AWS region to use for testing.') - booleanParam(name: 'debug', defaultValue: false, description: 'Allow debug logging for Jenkins steps') booleanParam(name: 'dry_run', defaultValue: false, description: 'Skip build steps, it is for testing pipeline flow') } From 08424710f683fc894717d14bbbd041556c79c595 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 20 Jul 2020 16:51:08 +0100 Subject: [PATCH 2/8] remove blank lines --- Jenkinsfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index aea0855c784..ad512c2e721 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -107,7 +107,6 @@ pipeline { mageTarget(context: "Elastic Agent x-pack Linux", directory: "x-pack/elastic-agent", target: "build test") } } - stage('Elastic Agent x-pack Windows'){ agent { label 'windows-immutable && windows-2019' } options { skipDefaultCheckout() } @@ -121,7 +120,6 @@ pipeline { mageTargetWin(context: "Elastic Agent x-pack Windows Unit test", directory: "x-pack/elastic-agent", target: "build unitTest") } } - stage('Elastic Agent Mac OS X'){ agent { label 'macosx' } options { skipDefaultCheckout() } @@ -140,7 +138,6 @@ pipeline { } } } - stage('Filebeat oss'){ agent { label 'ubuntu && immutable' } options { skipDefaultCheckout() } From 0e72e4af9f052786511635c69645fc2b73b65836 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 20 Jul 2020 17:05:26 +0100 Subject: [PATCH 3/8] [CI] Enable MacOS builds for PRs if UI based or GH comments, branches/tags will will run them always --- Jenkinsfile | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ad512c2e721..71b6a3e9a82 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -50,7 +50,7 @@ pipeline { rateLimitBuilds(throttle: [count: 60, durationName: 'hour', userBoost: true]) } triggers { - issueCommentTrigger('(?i).*(?:jenkins\\W+)?run\\W+(?:the\\W+)?tests(?:\\W+please)?.*') + issueCommentTrigger('(?i).*(?:jenkins\\W+)?run\\W+(?:the\\W+)?tests\\W+(?:for\\W+macos)?(?:\\W+please)?.*') } parameters { booleanParam(name: 'runAllStages', defaultValue: false, description: 'Allow to run all stages.') @@ -126,7 +126,7 @@ pipeline { when { beforeAgent true expression { - return env.BUILD_ELASTIC_AGENT_XPACK != "false" && params.macosTest + return env.BUILD_ELASTIC_AGENT_XPACK != "false" && env.BUILD_ON_MACOS != 'false' } } steps { @@ -170,7 +170,7 @@ pipeline { when { beforeAgent true expression { - return env.BUILD_FILEBEAT != "false" && params.macosTest + return env.BUILD_FILEBEAT != "false" && env.BUILD_ON_MACOS != 'false' } } steps { @@ -188,7 +188,7 @@ pipeline { when { beforeAgent true expression { - return env.BUILD_FILEBEAT_XPACK != "false" && params.macosTest + return env.BUILD_FILEBEAT_XPACK != "false" && env.BUILD_ON_MACOS != 'false' } } steps { @@ -247,7 +247,7 @@ pipeline { when { beforeAgent true expression { - return params.macosTest + return env.BUILD_ON_MACOS != 'false' } } steps { @@ -306,7 +306,7 @@ pipeline { when { beforeAgent true expression { - return env.BUILD_AUDITBEAT != "false" && params.macosTest + return env.BUILD_AUDITBEAT != "false" && env.BUILD_ON_MACOS != 'false' } } steps { @@ -350,7 +350,7 @@ pipeline { when { beforeAgent true expression { - return env.BUILD_AUDITBEAT_XPACK != "false" && params.macosTest + return env.BUILD_AUDITBEAT_XPACK != "false" && env.BUILD_ON_MACOS != 'false' } } steps { @@ -503,7 +503,7 @@ pipeline { when { beforeAgent true expression { - return env.BUILD_METRICBEAT != "false" && params.macosTest + return env.BUILD_METRICBEAT != "false" && env.BUILD_ON_MACOS != 'false' } } steps { @@ -516,7 +516,7 @@ pipeline { when { beforeAgent true expression { - return env.BUILD_METRICBEAT_XPACK != "false" && params.macosTest + return env.BUILD_METRICBEAT_XPACK != "false" && env.BUILD_ON_MACOS != 'false' } } steps { @@ -575,7 +575,7 @@ pipeline { when { beforeAgent true expression { - return params.macosTest + return env.BUILD_ON_MACOS != 'false' } } steps { @@ -686,7 +686,7 @@ pipeline { when { beforeAgent true expression { - return params.macosTest + return env.BUILD_ON_MACOS != 'false' } } steps { @@ -758,7 +758,7 @@ pipeline { when { beforeAgent true expression { - return params.macosTest + return env.BUILD_ON_MACOS != 'false' } } steps { @@ -776,7 +776,7 @@ pipeline { when { beforeAgent true expression { - return params.macosTest + return env.BUILD_ON_MACOS != 'false' } } steps { @@ -1342,6 +1342,12 @@ def loadConfigEnvVars(){ // Skip all the stages for changes only related to the documentation env.ONLY_DOCS = isDocChangedOnly() + + // Enable MacOSX when required: + // - UI parameter is set + // - by default for branches and tags + // - if GH comment that contains `for macos` + env.BUILD_ON_MACOS = params.macosTest || !isPR() || (env.GITHUB_COMMENT?.contains('for macos')) } /** From 3426b122db40db3c92e489da031ff3e3c43f2936 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 21 Jul 2020 10:40:33 +0100 Subject: [PATCH 4/8] Add support for GH labels filtering --- Jenkinsfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5e3f27253e9..41e5c0853d8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1350,11 +1350,11 @@ def loadConfigEnvVars(){ // Skip all the stages for changes only related to the documentation env.ONLY_DOCS = isDocChangedOnly() - // Enable MacOSX when required: - // - UI parameter is set - // - by default for branches and tags - // - if GH comment that contains `for macos` - env.BUILD_ON_MACOS = params.macosTest || !isPR() || (env.GITHUB_COMMENT?.contains('for macos')) + // Enable macOS builds when required + env.BUILD_ON_MACOS = params.macosTest // UI Input parameter is set to true + || !isPR() // For branches and tags + || matchesPrLabel(label: 'macOS') // If `macOS` GH label (Case-Sensitive) + || (env.GITHUB_COMMENT?.toLowerCase().contains('for macos')) // If `for macos` in the GH comment (Case-Insensitive) } /** From dc69ab107d55ed8c5705a66ac506cfa494d86aff Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 21 Jul 2020 10:49:52 +0100 Subject: [PATCH 5/8] Fix multiconditions --- Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 41e5c0853d8..81d4f13f47a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1351,10 +1351,10 @@ def loadConfigEnvVars(){ env.ONLY_DOCS = isDocChangedOnly() // Enable macOS builds when required - env.BUILD_ON_MACOS = params.macosTest // UI Input parameter is set to true - || !isPR() // For branches and tags - || matchesPrLabel(label: 'macOS') // If `macOS` GH label (Case-Sensitive) - || (env.GITHUB_COMMENT?.toLowerCase().contains('for macos')) // If `for macos` in the GH comment (Case-Insensitive) + env.BUILD_ON_MACOS = (params.macosTest // UI Input parameter is set to true + || !isPR() // For branches and tags + || matchesPrLabel(label: 'macOS') // If `macOS` GH label (Case-Sensitive) + || (env.GITHUB_COMMENT?.toLowerCase().contains('for macos'))) // If `for macos` in the GH comment (Case-Insensitive) } /** From b560ecccdec6803d103bede30b003e0d1940b3f6 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 21 Jul 2020 15:55:29 +0100 Subject: [PATCH 6/8] [CI] support /test macos comment --- Jenkinsfile | 6 +++--- README.md | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 81d4f13f47a..a80054a9309 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -50,7 +50,7 @@ pipeline { rateLimitBuilds(throttle: [count: 60, durationName: 'hour', userBoost: true]) } triggers { - issueCommentTrigger('(?i).*(?:jenkins\\W+)?run\\W+(?:the\\W+)?tests\\W+(?:for\\W+macos)?(?:\\W+please)?.*') + issueCommentTrigger('(?i)(.*(?:jenkins\\W+)?run\\W+(?:the\\W+)?tests(?:\\W+please)?.*|^\/test(\W+macos)?$)') } parameters { booleanParam(name: 'runAllStages', defaultValue: false, description: 'Allow to run all stages.') @@ -1351,10 +1351,10 @@ def loadConfigEnvVars(){ env.ONLY_DOCS = isDocChangedOnly() // Enable macOS builds when required - env.BUILD_ON_MACOS = (params.macosTest // UI Input parameter is set to true + env.BUILD_ON_MACOS = (params.macosTest // UI Input parameter is set to true || !isPR() // For branches and tags || matchesPrLabel(label: 'macOS') // If `macOS` GH label (Case-Sensitive) - || (env.GITHUB_COMMENT?.toLowerCase().contains('for macos'))) // If `for macos` in the GH comment (Case-Insensitive) + || (env.GITHUB_COMMENT?.toLowerCase().contains('/test macos'))) // If `/test macos` in the GH comment (Case-Insensitive) } /** diff --git a/README.md b/README.md index 1b383c288de..a85c40b3128 100644 --- a/README.md +++ b/README.md @@ -94,8 +94,8 @@ It is possible to trigger some jobs by putting a comment on a GitHub PR. (This service is only available for users affiliated with Elastic and not for open-source contributors.) * [beats][] - * `jenkins run the tests please` - * `jenkins run tests` + * `jenkins run the tests please` or `jenkins run tests` or `/test` will kick off a default build. + * `/test macos` will kick off a default build with also the `macos` stages. * [apm-beats-update][] * `/run apm-beats-update` From 270c91d6be4546319b23c205318d79a1ba8825b2 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 21 Jul 2020 17:40:54 +0100 Subject: [PATCH 7/8] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a80054a9309..eec3e9588b5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -50,7 +50,7 @@ pipeline { rateLimitBuilds(throttle: [count: 60, durationName: 'hour', userBoost: true]) } triggers { - issueCommentTrigger('(?i)(.*(?:jenkins\\W+)?run\\W+(?:the\\W+)?tests(?:\\W+please)?.*|^\/test(\W+macos)?$)') + issueCommentTrigger('(?i)(.*(?:jenkins\\W+)?run\\W+(?:the\\W+)?tests(?:\\W+please)?.*|^/test(\W+macos)?$)') } parameters { booleanParam(name: 'runAllStages', defaultValue: false, description: 'Allow to run all stages.') From fca4385c9085e9a25ae26aab65886aebeb315310 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 21 Jul 2020 17:42:15 +0100 Subject: [PATCH 8/8] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index eec3e9588b5..492c4404269 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -50,7 +50,7 @@ pipeline { rateLimitBuilds(throttle: [count: 60, durationName: 'hour', userBoost: true]) } triggers { - issueCommentTrigger('(?i)(.*(?:jenkins\\W+)?run\\W+(?:the\\W+)?tests(?:\\W+please)?.*|^/test(\W+macos)?$)') + issueCommentTrigger('(?i)(.*(?:jenkins\\W+)?run\\W+(?:the\\W+)?tests(?:\\W+please)?.*|^/test(\\W+macos)?$)') } parameters { booleanParam(name: 'runAllStages', defaultValue: false, description: 'Allow to run all stages.')