diff --git a/src/dev/failed_tests/cli.js b/src/dev/failed_tests/cli.js new file mode 100644 index 000000000000..7a0df52f8f4b --- /dev/null +++ b/src/dev/failed_tests/cli.js @@ -0,0 +1,22 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +require('../../setup_node_env'); +require('./report').reportFailedTests(); diff --git a/tasks/jenkins.js b/tasks/jenkins.js index 89f29b95e44e..b56cbdb7618d 100644 --- a/tasks/jenkins.js +++ b/tasks/jenkins.js @@ -17,8 +17,6 @@ * under the License. */ -import { reportFailedTests } from '../src/dev/failed_tests/report'; - module.exports = function (grunt) { grunt.registerTask('jenkins:docs', [ 'docker:docs' @@ -41,12 +39,4 @@ module.exports = function (grunt) { 'test:browser-ci', 'run:apiIntegrationTests', ]); - - grunt.registerTask( - 'jenkins:report', - 'Reports failed tests found in junit xml files to Github issues', - function () { - reportFailedTests(this.async()); - } - ); }; diff --git a/test/scripts/jenkins_ci_group.sh b/test/scripts/jenkins_ci_group.sh index 57250b1b0647..4c82f0adc4b1 100755 --- a/test/scripts/jenkins_ci_group.sh +++ b/test/scripts/jenkins_ci_group.sh @@ -2,6 +2,17 @@ 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 + source src/dev/ci_setup/checkout_sibling_es.sh "$(FORCE_COLOR=0 yarn bin)/grunt" functionalTests:ensureAllTestsInCiGroup; diff --git a/test/scripts/jenkins_report_failed_tests.sh b/test/scripts/jenkins_report_failed_tests.sh deleted file mode 100755 index c9e449d3304a..000000000000 --- a/test/scripts/jenkins_report_failed_tests.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -set -e - -xvfb-run "$(FORCE_COLOR=0 yarn bin)/grunt" jenkins:report; diff --git a/test/scripts/jenkins_unit.sh b/test/scripts/jenkins_unit.sh index 0ab7d6473822..8cb45141c0e0 100755 --- a/test/scripts/jenkins_unit.sh +++ b/test/scripts/jenkins_unit.sh @@ -2,8 +2,19 @@ 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 + source src/dev/ci_setup/checkout_sibling_es.sh export TEST_BROWSER_HEADLESS=1 export TEST_ES_FROM=${TEST_ES_FROM:-source} + "$(FORCE_COLOR=0 yarn bin)/grunt" jenkins:unit --from=source --dev; diff --git a/test/scripts/jenkins_xpack.sh b/test/scripts/jenkins_xpack.sh index ea610d4b0cf9..6c83faf045ae 100755 --- a/test/scripts/jenkins_xpack.sh +++ b/test/scripts/jenkins_xpack.sh @@ -2,6 +2,17 @@ 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 + source src/dev/ci_setup/checkout_sibling_es.sh export TEST_BROWSER_HEADLESS=1 diff --git a/test/scripts/jenkins_xpack_ci_group.sh b/test/scripts/jenkins_xpack_ci_group.sh index 11b16ba27a32..f6404bb2792f 100755 --- a/test/scripts/jenkins_xpack_ci_group.sh +++ b/test/scripts/jenkins_xpack_ci_group.sh @@ -2,6 +2,17 @@ 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 + source src/dev/ci_setup/checkout_sibling_es.sh export TEST_BROWSER_HEADLESS=1