diff --git a/Jenkinsfile b/Jenkinsfile index 5b905d7d3f3..492c4404269 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -50,17 +50,15 @@ 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+please)?.*|^/test(\\W+macos)?$)') } 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') } @@ -109,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() } @@ -123,14 +120,13 @@ 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() } 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 { @@ -142,7 +138,6 @@ pipeline { } } } - stage('Filebeat oss'){ agent { label 'ubuntu && immutable' } options { skipDefaultCheckout() } @@ -175,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 { @@ -193,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 { @@ -252,7 +247,7 @@ pipeline { when { beforeAgent true expression { - return params.macosTest + return env.BUILD_ON_MACOS != 'false' } } steps { @@ -311,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 { @@ -355,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 { @@ -508,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 { @@ -521,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 { @@ -580,7 +575,7 @@ pipeline { when { beforeAgent true expression { - return params.macosTest + return env.BUILD_ON_MACOS != 'false' } } steps { @@ -691,7 +686,7 @@ pipeline { when { beforeAgent true expression { - return params.macosTest + return env.BUILD_ON_MACOS != 'false' } } steps { @@ -763,7 +758,7 @@ pipeline { when { beforeAgent true expression { - return params.macosTest + return env.BUILD_ON_MACOS != 'false' } } steps { @@ -781,7 +776,7 @@ pipeline { when { beforeAgent true expression { - return params.macosTest + return env.BUILD_ON_MACOS != 'false' } } steps { @@ -1354,6 +1349,12 @@ def loadConfigEnvVars(){ // Skip all the stages for changes only related to the documentation 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('/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`