<commit_before>#!/bin/bash
set -eo pipefail

SELFDIR=$(dirname "$0")
SELFDIR=$(cd "$SELFDIR" && pwd)
PASSENGER_ROOT=$(cd "$SELFDIR/../../.." && pwd)
# shellcheck source=lib/functions.sh
source "$SELFDIR/../lib/functions.sh"

if ! "$@"; then
	echo
	echo "-----------------------------"
	echo
	echo "*** An error occurred ***"
	echo
	echo "Preparing artifacts for archival..."
	run mkdir -p buildout/artifacts
	if [[ -e test/test.log ]]; then
		run cp test/test.log buildout/artifacts/
	fi
	if ls -Ad /tmp/psg-test-* >/dev/null 2>/dev/null; then
		run cp /tmp/psg-test-* buildout/artifacts/
	fi

	if [[ "$DEBUG_CONSOLE" == 1 ]]; then
		echo
		echo "DEBUG_CONSOLE set to 1, so launching a debugging console..."
		echo
		# shellcheck source=../lib/set-container-envvars.sh
		set +e
		source "$PASSENGER_ROOT/dev/ci/lib/set-container-envvars.sh"
		header2 "Launching bash"
		bash -l
	else
		echo "If you want to debug this, run '$CI_COMMAND' with the environment variable DEBUG_CONSOLE=1."
	fi
	exit 1
fi<commit_msg>Jenkins CI: properly archive SpawningKit error reports<commit_after>#!/bin/bash
set -eo pipefail

SELFDIR=$(dirname "$0")
SELFDIR=$(cd "$SELFDIR" && pwd)
PASSENGER_ROOT=$(cd "$SELFDIR/../../.." && pwd)
# shellcheck source=lib/functions.sh
source "$SELFDIR/../lib/functions.sh"

if ! "$@"; then
	echo
	echo "-----------------------------"
	echo
	echo "*** An error occurred ***"
	echo
	echo "Preparing artifacts for archival..."
	run mkdir -p buildout/artifacts
	if [[ -e test/test.log ]]; then
		run cp test/test.log buildout/artifacts/
	fi
	if ls -Ad /tmp/psg-test-*/passenger-error-*.html >/dev/null 2>/dev/null; then
		run cp /tmp/psg-test-*/passenger-error-*.html buildout/artifacts/
	fi

	if [[ "$DEBUG_CONSOLE" == 1 ]]; then
		echo
		echo "DEBUG_CONSOLE set to 1, so launching a debugging console..."
		echo
		# shellcheck source=../lib/set-container-envvars.sh
		set +e
		source "$PASSENGER_ROOT/dev/ci/lib/set-container-envvars.sh"
		header2 "Launching bash"
		bash -l
	else
		echo "If you want to debug this, run '$CI_COMMAND' with the environment variable DEBUG_CONSOLE=1."
	fi
	exit 1
fi
{'fraction_non_alphanumeric': 0.1816026552868658, 'fraction_numerical': 0.006638217164532954, 'mean_word_length': 3.0970873786407767, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '961587', 'n_tokens_mistral': 818, 'n_tokens_neox': 762, 'n_words': 209}