Skip to content

Commit

Permalink
[6.8] Call failure reporter directly from Jenkinsfile (#45551) (#45673)
Browse files Browse the repository at this point in the history
* Call failure reporter directly from Jenkinsfile (#45551)

* Run failed_tests/cli once per node

* force failures for testing

* Revert "force failures for testing"

This reverts commit 3ddd924.

# Conflicts:
#	test/scripts/jenkins_firefox_smoke.sh
#	test/scripts/jenkins_visual_regression.sh
#	test/scripts/jenkins_xpack_firefox_smoke.sh
#	test/scripts/jenkins_xpack_visual_regression.sh

* set NODE_OPTIONS for build
  • Loading branch information
Spencer committed Sep 16, 2019
1 parent e7467e5 commit c638263
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 15 deletions.
16 changes: 15 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ def withWorkers(name, preWorkerClosure = {}, workerClosures = [:]) {
catchError {
publishJunit()
}

catchError {
runErrorReporter()
}
}
}
}
Expand Down Expand Up @@ -143,6 +147,9 @@ def legacyJobRunner(name) {
catchError {
publishJunit()
}
catchError {
runErrorReporter()
}
}
}
}
Expand Down Expand Up @@ -247,7 +254,7 @@ def runbld(script) {
}

def bash(script) {
sh "#!/bin/bash -x\n${script}"
sh "#!/bin/bash\n${script}"
}

def doSetup() {
Expand All @@ -261,3 +268,10 @@ def buildOss() {
def buildXpack() {
runbld "./test/scripts/jenkins_xpack_build_kibana.sh"
}

def runErrorReporter() {
bash """
source src/dev/ci_setup/setup_env.sh
node src/dev/failed_tests/cli
"""
}
3 changes: 2 additions & 1 deletion src/dev/build/tasks/optimize_task.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export const OptimizeBuildTask = {
await exec(log, kibanaScript, kibanaArgs, {
cwd: build.resolvePath('.'),
env: {
FORCE_DLL_CREATION: 'true'
FORCE_DLL_CREATION: 'true',
NODE_OPTIONS: '--max-old-space-size=3072',
},
});

Expand Down
6 changes: 1 addition & 5 deletions src/dev/failed_tests/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,15 @@ const { resolve } = require('path');
process.chdir(resolve(__dirname, '../../..'));

// JOB_NAME is formatted as `elastic+kibana+7.x` in some places and `elastic+kibana+7.x/JOB=kibana-intake,node=immutable` in others

const jobNameSplit = (process.env.JOB_NAME || '').split(/\+|\//);
const branch = jobNameSplit.length >= 3 ? jobNameSplit[2] : process.env.GIT_BRANCH;

const isPr = !!process.env.ghprbPullId;

if (!branch) {
console.log('Unable to determine originating branch from job name or other environment variables');
process.exit(1);
}

const isPr = !!process.env.ghprbPullId;
const isMasterOrVersion = branch.match(/^(origin\/){0,1}master$/) || branch.match(/^(origin\/){0,1}\d+\.(x|\d+)$/);

if (!isMasterOrVersion || isPr) {
console.log('Failure issues only created on master/version branch jobs');
process.exit(0);
Expand Down
5 changes: 3 additions & 2 deletions test/scripts/jenkins_ci_group.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/usr/bin/env bash

set -e
trap 'node "$KIBANA_DIR/src/dev/failed_tests/cli"' EXIT

if [[ "$IS_PIPELINE_JOB" ]] ; then
if [[ -z "$IS_PIPELINE_JOB" ]] ; then
trap 'node "$KIBANA_DIR/src/dev/failed_tests/cli"' EXIT
else
source src/dev/ci_setup/setup_env.sh
fi

Expand Down
5 changes: 4 additions & 1 deletion test/scripts/jenkins_unit.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/usr/bin/env bash

set -e
trap 'node "$KIBANA_DIR/src/dev/failed_tests/cli"' EXIT

if [[ -z "$IS_PIPELINE_JOB" ]] ; then
trap 'node "$KIBANA_DIR/src/dev/failed_tests/cli"' EXIT
fi

export TEST_BROWSER_HEADLESS=1

Expand Down
5 changes: 4 additions & 1 deletion test/scripts/jenkins_xpack.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/usr/bin/env bash

set -e
trap 'node "$KIBANA_DIR/src/dev/failed_tests/cli"' EXIT

if [[ -z "$IS_PIPELINE_JOB" ]] ; then
trap 'node "$KIBANA_DIR/src/dev/failed_tests/cli"' EXIT
fi

export TEST_BROWSER_HEADLESS=1

Expand Down
9 changes: 5 additions & 4 deletions test/scripts/jenkins_xpack_ci_group.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#!/usr/bin/env bash

set -e
trap 'node "$KIBANA_DIR/src/dev/failed_tests/cli"' EXIT

export TEST_BROWSER_HEADLESS=1

if [[ "$IS_PIPELINE_JOB" ]] ; then
if [[ -z "$IS_PIPELINE_JOB" ]] ; then
trap 'node "$KIBANA_DIR/src/dev/failed_tests/cli"' EXIT
else
source src/dev/ci_setup/setup_env.sh
fi

export TEST_BROWSER_HEADLESS=1

if [[ -z "$IS_PIPELINE_JOB" ]] ; then
echo " -> Ensuring all functional tests are in a ciGroup"
cd "$XPACK_DIR"
Expand Down

0 comments on commit c638263

Please sign in to comment.