Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call failure reporter directly from Jenkinsfile #45551

Merged
merged 3 commits into from
Sep 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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