Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into feature/windows-2016
Browse files Browse the repository at this point in the history
* upstream/master:
  Skip flaky test TestClientPublishEventKerberosAware (elastic#21296)
  [CI] Enable macOS builds for branches/tags (elastic#21323)
  [CI] refactor runbld post build action (elastic#21256)
  [CI] cherry-pick elastic#20891 (elastic#21314)
  • Loading branch information
v1v committed Sep 28, 2020
2 parents 4a3b44c + a75582f commit 835e53a
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 59 deletions.
53 changes: 6 additions & 47 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ pipeline {
agent { label 'ubuntu-18 && immutable' }
environment {
AWS_ACCOUNT_SECRET = 'secret/observability-team/ci/elastic-observability-aws-account-auth'
BASE_DIR = 'src/github.com/elastic/beats'
REPO = 'beats'
BASE_DIR = "src/github.com/elastic/${env.REPO}"
DOCKERELASTIC_SECRET = 'secret/observability-team/ci/docker-registry/prod'
DOCKER_COMPOSE_VERSION = "1.21.0"
DOCKER_REGISTRY = 'docker.elastic.co'
Expand All @@ -21,6 +22,7 @@ pipeline {
JOB_GCS_CREDENTIALS = 'beats-ci-gcs-plugin'
OSS_MODULE_PATTERN = '^[a-z0-9]+beat\\/module\\/([^\\/]+)\\/.*'
PIPELINE_LOG_LEVEL = 'INFO'
PYTEST_ADDOPTS = "${params.PYTEST_ADDOPTS}"
RUNBLD_DISABLE_NOTIFICATIONS = 'true'
TERRAFORM_VERSION = "0.12.24"
XPACK_MODULE_PATTERN = '^x-pack\\/[a-z0-9]+beat\\/module\\/([^\\/]+)\\/.*'
Expand All @@ -44,6 +46,7 @@ pipeline {
string(name: 'awsRegion', defaultValue: 'eu-central-1', description: 'Default AWS region to use for testing.')
booleanParam(name: 'runAllStages', defaultValue: false, description: 'Allow to run all stages.')
booleanParam(name: 'macosTest', defaultValue: false, description: 'Allow macOS stages.')
string(name: 'PYTEST_ADDOPTS', defaultValue: '', description: 'Additional options to pass to pytest. Use PYTEST_ADDOPTS="-k pattern" to only run tests matching the specified pattern. For retries you can use `--reruns 3 --reruns-delay 15`')
}
stages {
stage('Checkout') {
Expand Down Expand Up @@ -120,7 +123,7 @@ pipeline {
}
post {
always {
runbld()
runbld(stashedTestReports: stashedTestReports, project: env.REPO)
}
cleanup {
notifyBuildResult(prComment: true)
Expand Down Expand Up @@ -346,7 +349,7 @@ def archiveTestOutput(Map args = [:]) {
}
cmd(label: 'Prepare test output', script: 'python .ci/scripts/pre_archive_test.py')
dir('build') {
junitAndStore(allowEmptyResults: true, keepLongStdio: true, testResults: args.testResults, id: args.id)
junitAndStore(allowEmptyResults: true, keepLongStdio: true, testResults: args.testResults, stashedTestReports: stashedTestReports, id: args.id)
archiveArtifacts(allowEmptyArchive: true, artifacts: args.artifacts)
}
catchError(buildResult: 'SUCCESS', message: 'Failed to archive the build test results', stageResult: 'SUCCESS') {
Expand All @@ -360,50 +363,6 @@ def archiveTestOutput(Map args = [:]) {
}
}

/**
* This method wraps the junit built-in step to archive the test reports that gonna be populated later on
* with the runbld post build step.
*/
def junitAndStore(Map args = [:]) {
junit(args)
// args.id could be null in some cases, so let's use the currentmilliseconds
def stageName = args.id ? args.id?.replaceAll("[\\W]|_",'-') : "uncategorized-${new java.util.Date().getTime()}"
stash(includes: args.testResults, allowEmpty: true, name: stageName, useDefaultExcludes: true)
stashedTestReports[stageName] = stageName
}

/**
* This method populates the test output using the runbld approach. For such it requires the
* global variable stashedTestReports.
* TODO: should be moved to the shared library
*/
def runbld() {
catchError(buildResult: 'SUCCESS', message: 'runbld post build action failed.') {
if (stashedTestReports) {
def jobName = isPR() ? 'elastic+beats+pull-request' : 'elastic+beats'
deleteDir()
unstashV2(name: 'source', bucket: "${JOB_GCS_BUCKET}", credentialsId: "${JOB_GCS_CREDENTIALS}")
dir("${env.BASE_DIR}") {
// Unstash the test reports
stashedTestReports.each { k, v ->
dir(k) {
unstash(v)
}
}
}
sh(label: 'Process JUnit reports with runbld',
script: """\
## for debugging purposes
find . -name "TEST-*.xml"
cat >./runbld-script <<EOF
echo "Processing JUnit reports with runbld..."
EOF
/usr/local/bin/runbld ./runbld-script --job-name ${jobName}
""".stripIndent()) // stripIdent() requires '''/
}
}
}

/**
* This method executes a closure with credentials for cloud test
* environments.
Expand Down
4 changes: 3 additions & 1 deletion auditbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ stages:
mage: "mage build unitTest"
platforms: ## override default label in this specific stage.
- "macosx"
when: ## Aggregate when with the top-level one.
when: ## Override the top-level when.
comments:
- "/test auditbeat for macos"
labels:
- "macOS"
parameters:
- "macosTest"
branches: true ## for all the branches
tags: true ## for all the tags
windows:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
Expand Down
4 changes: 3 additions & 1 deletion filebeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ stages:
mage: "mage build unitTest"
platforms: ## override default label in this specific stage.
- "macosx"
when: ## Aggregate when with the top-level one.
when: ## Override the top-level when.
comments:
- "/test filebeat for macos"
labels:
- "macOS"
parameters:
- "macosTest"
branches: true ## for all the branches
tags: true ## for all the tags
windows:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
Expand Down
8 changes: 6 additions & 2 deletions generator/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,25 @@ stages:
make: "make -C generator/_templates/metricbeat test"
platforms: ## override default label in this specific stage.
- "macosx"
when: ## Aggregate when with the top-level one.
when: ## Override the top-level when.
comments:
- "/test generator for macos"
labels:
- "macOS"
parameters:
- "macosTest"
branches: true ## for all the branches
tags: true ## for all the tags
macos-beat:
make: "make -C generator/_templates/beat test"
platforms: ## override default label in this specific stage.
- "macosx"
when: ## Aggregate when with the top-level one.
when: ## Override the top-level when.
comments:
- "/test generator for macos"
labels:
- "macOS"
parameters:
- "macosTest"
branches: true ## for all the branches
tags: true ## for all the tags
4 changes: 3 additions & 1 deletion heartbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ stages:
mage: "mage build unitTest"
platforms: ## override default label in this specific stage.
- "macosx"
when: ## Aggregate when with the top-level one.
when: ## Override the top-level when.
comments:
- "/test heartbeat for macos"
labels:
- "macOS"
parameters:
- "macosTest"
branches: true ## for all the branches
tags: true ## for all the tags
windows:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
Expand Down
2 changes: 2 additions & 0 deletions libbeat/outputs/elasticsearch/client_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ func TestClientPublishEvent(t *testing.T) {
}

func TestClientPublishEventKerberosAware(t *testing.T) {
t.Skip("Flaky test: https://github.com/elastic/beats/issues/21295")

err := setupRoleMapping(t, eslegtest.GetEsKerberosHost())
if err != nil {
t.Fatal(err)
Expand Down
4 changes: 3 additions & 1 deletion metricbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ stages:
mage: "mage build unitTest"
platforms: ## override default label in this specific stage.
- "macosx"
when: ## Aggregate when with the top-level one.
when: ## Override the top-level when.
comments:
- "/test metricbeat for macos"
labels:
- "macOS"
parameters:
- "macosTest"
branches: true ## for all the branches
tags: true ## for all the tags
windows:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
Expand Down
4 changes: 3 additions & 1 deletion packetbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ stages:
mage: "mage build unitTest"
platforms: ## override default label in this specific stage.
- "macosx"
when: ## Aggregate when with the top-level one.
when: ## Override the top-level when.
comments:
- "/test packetbeat for macos"
labels:
- "macOS"
parameters:
- "macosTest"
branches: true ## for all the branches
tags: true ## for all the tags
windows:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
Expand Down
4 changes: 3 additions & 1 deletion x-pack/auditbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ stages:
mage: "mage build unitTest"
platforms: ## override default label in this specific stage.
- "macosx"
when: ## Aggregate when with the top-level one.
when: ## Override the top-level when.
comments:
- "/test auditbeat for macos"
labels:
- "macOS"
parameters:
- "macosTest"
branches: true ## for all the branches
tags: true ## for all the tags
windows:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
Expand Down
4 changes: 3 additions & 1 deletion x-pack/elastic-agent/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ stages:
mage: "mage build unitTest"
platforms: ## override default label in this specific stage.
- "macosx"
when: ## Aggregate when with the top-level one.
when: ## Override the top-level when.
comments:
- "/test x-pack/elastic-agent for macos"
labels:
- "macOS"
parameters:
- "macosTest"
branches: true ## for all the branches
tags: true ## for all the tags
windows:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
Expand Down
4 changes: 3 additions & 1 deletion x-pack/filebeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ stages:
mage: "mage build unitTest"
platforms: ## override default label in this specific stage.
- "macosx"
when: ## Aggregate when with the top-level one.
when: ## Override the top-level when.
comments:
- "/test x-pack/filebeat for macos"
labels:
- "macOS"
parameters:
- "macosTest"
branches: true ## for all the branches
tags: true ## for all the tags
windows:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
Expand Down
4 changes: 3 additions & 1 deletion x-pack/functionbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ stages:
mage: "mage build unitTest"
platforms: ## override default label in this specific stage.
- "macosx"
when: ## Aggregate when with the top-level one.
when: ## Override the top-level when.
comments:
- "/test x-pack/functionbeat for macos"
labels:
- "macOS"
parameters:
- "macosTest"
branches: true ## for all the branches
tags: true ## for all the tags
windows:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
Expand Down
4 changes: 3 additions & 1 deletion x-pack/metricbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ stages:
mage: "mage build unitTest"
platforms: ## override default label in this specific stage.
- "macosx"
when: ## Aggregate when with the top-level one.
when: ## Override the top-level when.
comments:
- "/test x-pack/metricbeat for macos"
labels:
- "macOS"
parameters:
- "macosTest"
branches: true ## for all the branches
tags: true ## for all the tags
windows:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
Expand Down

0 comments on commit 835e53a

Please sign in to comment.