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: run test on Windows #15570

Merged
merged 15 commits into from
Feb 7, 2020
Merged
133 changes: 101 additions & 32 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,7 @@ pipeline {
deleteDir()
gitCheckout(basedir: "${BASE_DIR}")
dir("${BASE_DIR}"){
script {
env.GO_VERSION = readFile(".go-version").trim()
env.BUILD_FILEBEAT = isChanged(["^filebeat/.*"])
env.BUILD_HEARTBEAT = isChanged(["^heartbeat/.*"])
env.BUILD_AUDITBEAT = isChanged(["^auditbeat/.*"])
env.BUILD_METRICBEAT = isChanged(["^metricbeat/.*"])
env.BUILD_PACKETBEAT = isChanged(["^packetbeat/.*"])
env.BUILD_WINLOGBEAT = isChanged(["^winlogbeat/.*"])
env.BUILD_DOCKERLOGBEAT = isChanged(["^x-pack/dockerlogbeat/.*"])
env.BUILD_FUNCTIONBEAT = isChanged(["^x-pack/functionbeat/.*"])
env.BUILD_JOURNALBEAT = isChanged(["^journalbeat/.*"])
env.BUILD_GENERATOR = isChanged(["^generator/.*"])
env.BUILD_KUBERNETES = isChanged(["^deploy/kubernetes/*"])
env.BUILD_DOCS = isGitRegionMatch(patterns: ["^docs/.*"], comparator: 'regexp') || params.runAllStages
env.BUILD_LIBBEAT = isGitRegionMatch(patterns: ["^libbeat/.*","^x-pack/filebeat./*"], comparator: 'regexp') || params.runAllStages
}
loadConfigEnvVars()
}
stash allowEmpty: true, name: 'source', useDefaultExcludes: false
}
Expand Down Expand Up @@ -84,7 +69,7 @@ pipeline {
when {
beforeAgent true
expression {
return env.BUILD_FILEBEAT != "false"
return env.BUILD_FILEBEAT_XPACK != "false"
}
}
steps {
Expand Down Expand Up @@ -155,7 +140,7 @@ pipeline {
}
}
}
stage('Auditbeat'){
stage('Auditbeat oss'){
agent { label 'ubuntu && immutable' }
options { skipDefaultCheckout() }
when {
Expand All @@ -165,7 +150,7 @@ pipeline {
}
}
stages {
stage('Auditbeat oss'){
stage('Auditbeat Linux'){
steps {
makeTarget("Auditbeat oss Linux", "-C auditbeat testsuite")
}
Expand All @@ -175,11 +160,6 @@ pipeline {
makeTarget("Auditbeat oss crosscompile", "-C auditbeat crosscompile")
}
}
stage('Auditbeat x-pack'){
steps {
makeTarget("Auditbeat x-pack Linux", "-C x-pack/auditbeat testsuite")
}
}
stage('Auditbeat Mac OS X'){
agent { label 'macosx' }
options { skipDefaultCheckout() }
Expand All @@ -203,6 +183,19 @@ pipeline {
}
}
}
stage('Auditbeat x-pack'){
agent { label 'ubuntu && immutable' }
options { skipDefaultCheckout() }
when {
beforeAgent true
expression {
return env.BUILD_AUDITBEAT_XPACK != "false"
}
}
steps {
makeTarget("Auditbeat x-pack Linux", "-C x-pack/auditbeat testsuite")
}
}
stage('Libbeat'){
agent { label 'ubuntu && immutable' }
options { skipDefaultCheckout() }
Expand All @@ -228,12 +221,20 @@ pipeline {
makeTarget("Libbeat stress-tests", "STRESS_TEST_OPTIONS='-timeout=20m -race -v -parallel 1' -C libbeat stress-tests")
}
}
stage('Libbeat x-pack'){
steps {
makeTarget("Libbeat x-pack Linux", "-C x-pack/libbeat testsuite")
}
}
}
stage('Libbeat x-pack'){
agent { label 'ubuntu && immutable' }
options { skipDefaultCheckout() }
when {
beforeAgent true
expression {
return env.BUILD_LIBBEAT_XPACK != "false"
}
}
steps {
makeTarget("Libbeat x-pack Linux", "-C x-pack/libbeat testsuite")
}
}
stage('Metricbeat Unit tests'){
agent { label 'ubuntu && immutable' }
Expand Down Expand Up @@ -274,13 +275,13 @@ pipeline {
makeTarget("Metricbeat System tests", "-C metricbeat update system-tests-environment coverage-report")
}
}
stage('Metricbeat oss'){
stage('Metricbeat x-pack'){
agent { label 'ubuntu && immutable' }
options { skipDefaultCheckout() }
when {
beforeAgent true
expression {
return env.BUILD_METRICBEAT != "false"
return env.BUILD_METRICBEAT_XPACK != "false"
}
}
steps {
Expand Down Expand Up @@ -350,7 +351,7 @@ pipeline {
when {
beforeAgent true
expression {
return env.BUILD_DOCKERLOGBEAT != "false"
return env.BUILD_DOCKERLOGBEAT_XPACK != "false"
}
}
stages {
Expand Down Expand Up @@ -397,7 +398,7 @@ pipeline {
when {
beforeAgent true
expression {
return env.BUILD_FUNCTIONBEAT != "false"
return env.BUILD_FUNCTIONBEAT_XPACK != "false"
}
}
stages {
Expand Down Expand Up @@ -628,3 +629,71 @@ def isChanged(patterns){
|| isGitRegionMatch(patterns: ["^libbeat/.*"], comparator: 'regexp')
)
}

def loadConfigEnvVars(){
env.BUILD_AUDITBEAT = isChanged(["^auditbeat/.*"])
env.BUILD_AUDITBEAT_XPACK = isChanged([
"^auditbeat/.*",
"^x-pack/auditbeat/.*",
"^x-pack/libbeat/.*",
])
env.BUILD_DOCKERLOGBEAT_XPACK = isChanged([
"^x-pack/dockerlogbeat/.*",
"^x-pack/libbeat/.*",
])
env.BUILD_DOCS = isGitRegionMatch(
patterns: ["^docs/.*"],
comparator: 'regexp'
) || params.runAllStages
env.BUILD_FILEBEAT = isChanged(["^filebeat/.*"])
env.BUILD_FILEBEAT_XPACK = isChanged([
"^filebeat/.*",
"^x-pack/filebeat/.*",
"^x-pack/libbeat/.*",
])
env.BUILD_FUNCTIONBEAT_XPACK = isChanged([
"^x-pack/functionbeat/.*",
"^x-pack/libbeat/.*",
])
env.BUILD_GENERATOR = isChanged(["^generator/.*"])
env.BUILD_HEARTBEAT = isChanged(["^heartbeat/.*"])
env.BUILD_HEARTBEAT_XPACK = isChanged([
"^heartbeat/.*",
"^x-pack/heartbeat/.*",
"^x-pack/libbeat/.*",
])
env.BUILD_JOURNALBEAT = isChanged(["^journalbeat/.*"])
env.BUILD_JOURNALBEAT_XPACK = isChanged([
"^journalbeat/.*",
"^x-pack/journalbeat/.*",
"^x-pack/libbeat/.*",
])
env.BUILD_KUBERNETES = isChanged(["^deploy/kubernetes/*"])
env.BUILD_LIBBEAT = isGitRegionMatch(
patterns: ["^libbeat/.*"],
comparator: 'regexp'
) || params.runAllStages
env.BUILD_LIBBEAT_XPACK = isChanged([
"^libbeat/.*",
kuisathaverat marked this conversation as resolved.
Show resolved Hide resolved
"^x-pack/libbeat/.*",
])
env.BUILD_METRICBEAT = isChanged(["^metricbeat/.*"])
env.BUILD_METRICBEAT_XPACK = isChanged([
"^metricbeat/.*",
"^x-pack/libbeat/.*",
"^x-pack/metricbeat/.*",
])
env.BUILD_PACKETBEAT = isChanged(["^packetbeat/.*"])
env.BUILD_PACKETBEAT_XPACK = isChanged([
"^packetbeat/.*",
"^x-pack/libbeat/.*",
"^x-pack/packetbeat/.*",
])
env.BUILD_WINLOGBEAT = isChanged(["^winlogbeat/.*"])
env.BUILD_WINLOGBEAT_XPACK = isChanged([
"^winlogbeat/.*",
"^x-pack/libbeat/.*",
"^x-pack/winlogbeat/.*",
])
env.GO_VERSION = readFile(".go-version").trim()
}