From 3bc5595ce382736929fd0c00fddeb46411ca2424 Mon Sep 17 00:00:00 2001 From: Spencer Date: Mon, 10 Jun 2019 07:04:32 -0700 Subject: [PATCH] [testFailureReporting] only run on master/version jobs (#38497) --- src/dev/failed_tests/cli.js | 11 +++++++++++ test/scripts/jenkins_ci_group.sh | 12 +----------- test/scripts/jenkins_unit.sh | 11 +---------- test/scripts/jenkins_xpack.sh | 12 +----------- test/scripts/jenkins_xpack_ci_group.sh | 12 +----------- 5 files changed, 15 insertions(+), 43 deletions(-) diff --git a/src/dev/failed_tests/cli.js b/src/dev/failed_tests/cli.js index 7a0df52f8f4b..df934407e000 100644 --- a/src/dev/failed_tests/cli.js +++ b/src/dev/failed_tests/cli.js @@ -17,6 +17,17 @@ * under the License. */ +if (!process.env.JOB_NAME) { + console.log('Unable to determine job name'); + process.exit(1); +} + +const [org, proj, branch] = process.env.JOB_NAME.split('+'); +const masterOrVersion = branch === 'master' || branch.match(/^\d+\.(x|\d+)$/); +if (!(org === 'elastic' && proj === 'kibana' && masterOrVersion)) { + console.log('Failure issues only created on master/version branch jobs'); + process.exit(0); +} require('../../setup_node_env'); require('./report').reportFailedTests(); diff --git a/test/scripts/jenkins_ci_group.sh b/test/scripts/jenkins_ci_group.sh index 521719be6a1a..0e8ace5835e2 100755 --- a/test/scripts/jenkins_ci_group.sh +++ b/test/scripts/jenkins_ci_group.sh @@ -1,17 +1,7 @@ #!/usr/bin/env bash set -e - -function report { - if [[ -z "$PR_SOURCE_BRANCH" ]]; then - node src/dev/failed_tests/cli - else - echo "Failure issues not created on pull requests" - - fi -} - -trap report EXIT +trap 'node "$KIBANA_DIR/src/dev/failed_tests/cli"' EXIT "$(FORCE_COLOR=0 yarn bin)/grunt" functionalTests:ensureAllTestsInCiGroup; diff --git a/test/scripts/jenkins_unit.sh b/test/scripts/jenkins_unit.sh index 689e18d59629..b5ae3724ce37 100755 --- a/test/scripts/jenkins_unit.sh +++ b/test/scripts/jenkins_unit.sh @@ -1,16 +1,7 @@ #!/usr/bin/env bash set -e - -function report { - if [[ -z "$PR_SOURCE_BRANCH" ]]; then - node src/dev/failed_tests/cli - else - echo "Failure issues not created on pull requests" - fi -} - -trap report EXIT +trap 'node "$KIBANA_DIR/src/dev/failed_tests/cli"' EXIT export TEST_BROWSER_HEADLESS=1 diff --git a/test/scripts/jenkins_xpack.sh b/test/scripts/jenkins_xpack.sh index 6ae76995c63b..11eeaccb1114 100755 --- a/test/scripts/jenkins_xpack.sh +++ b/test/scripts/jenkins_xpack.sh @@ -1,17 +1,7 @@ #!/usr/bin/env bash set -e - -function report { - if [[ -z "$PR_SOURCE_BRANCH" ]]; then - cd "$KIBANA_DIR" - node src/dev/failed_tests/cli - else - echo "Failure issues not created on pull requests" - fi -} - -trap report EXIT +trap 'node "$KIBANA_DIR/src/dev/failed_tests/cli"' EXIT export TEST_BROWSER_HEADLESS=1 diff --git a/test/scripts/jenkins_xpack_ci_group.sh b/test/scripts/jenkins_xpack_ci_group.sh index bc5da339d567..b6d247bb0641 100755 --- a/test/scripts/jenkins_xpack_ci_group.sh +++ b/test/scripts/jenkins_xpack_ci_group.sh @@ -1,17 +1,7 @@ #!/usr/bin/env bash set -e - -function report { - if [[ -z "$PR_SOURCE_BRANCH" ]]; then - cd "$KIBANA_DIR" - node src/dev/failed_tests/cli - else - echo "Failure issues not created on pull requests" - fi -} - -trap report EXIT +trap 'node "$KIBANA_DIR/src/dev/failed_tests/cli"' EXIT export TEST_BROWSER_HEADLESS=1