Skip to content

Commit

Permalink
Run failed_tests/cli once per node
Browse files Browse the repository at this point in the history
  • Loading branch information
spalger committed Sep 13, 2019
1 parent 17f844a commit f1d1bd2
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 23 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 @@ -248,7 +255,7 @@ def runbld(script) {
}

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

def doSetup() {
Expand All @@ -262,3 +269,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
"""
}
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
7 changes: 4 additions & 3 deletions test/scripts/jenkins_ci_group.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#!/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

export TEST_BROWSER_HEADLESS=1

if [[ -z "$IS_PIPELINE_JOB" ]] ; then
yarn run grunt functionalTests:ensureAllTestsInCiGroup;
yarn run grunt functionalTests:ensureAllTestsInCiGroup;
node scripts/build --debug --oss;
else
installDir="$(realpath $PARENT_DIR/kibana/build/oss/kibana-*-SNAPSHOT-linux-x86_64)"
Expand Down
5 changes: 3 additions & 2 deletions test/scripts/jenkins_firefox_smoke.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: 3 additions & 2 deletions test/scripts/jenkins_visual_regression.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_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
5 changes: 3 additions & 2 deletions test/scripts/jenkins_xpack_firefox_smoke.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: 3 additions & 2 deletions test/scripts/jenkins_xpack_visual_regression.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

0 comments on commit f1d1bd2

Please sign in to comment.