Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] MacOS stages for branches/tags and PRs when certain conditions #20069

Merged
merged 9 commits into from
Jul 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 20 additions & 19 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
Expand Down Expand Up @@ -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() }
Expand All @@ -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 {
Expand All @@ -142,7 +138,6 @@ pipeline {
}
}
}

stage('Filebeat oss'){
agent { label 'ubuntu && immutable' }
options { skipDefaultCheckout() }
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -252,7 +247,7 @@ pipeline {
when {
beforeAgent true
expression {
return params.macosTest
return env.BUILD_ON_MACOS != 'false'
}
}
steps {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -580,7 +575,7 @@ pipeline {
when {
beforeAgent true
expression {
return params.macosTest
return env.BUILD_ON_MACOS != 'false'
}
}
steps {
Expand Down Expand Up @@ -691,7 +686,7 @@ pipeline {
when {
beforeAgent true
expression {
return params.macosTest
return env.BUILD_ON_MACOS != 'false'
}
}
steps {
Expand Down Expand Up @@ -763,7 +758,7 @@ pipeline {
when {
beforeAgent true
expression {
return params.macosTest
return env.BUILD_ON_MACOS != 'false'
}
}
steps {
Expand All @@ -781,7 +776,7 @@ pipeline {
when {
beforeAgent true
expression {
return params.macosTest
return env.BUILD_ON_MACOS != 'false'
}
}
steps {
Expand Down Expand Up @@ -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)
}

/**
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down