diff --git a/hack/ginkgo-e2e.sh b/hack/ginkgo-e2e.sh
index b621813932a..409ff5892cd 100755
--- a/hack/ginkgo-e2e.sh
+++ b/hack/ginkgo-e2e.sh
@@ -163,6 +163,18 @@ if [[ "${GINKGO_NO_COLOR}" == "y" ]]; then
ginkgo_args+=("--no-color")
fi
+if [[ -n "${E2E_REPORT_DIR:-}" ]]; then
+ report_dir="${E2E_REPORT_DIR}"
+else
+ # Some jobs don't use E2E_REPORT_DIR and instead pass --report-dir=
+ # as parameter.
+ for arg in "${@}"; do
+ # shellcheck disable=SC2001
+ # (style): See if you can use ${variable//search/replace} instead.
+ case "$arg" in -report-dir=*|--report-dir=*) report_dir="$(echo "$arg" | sed -e 's/^[^=]*=//')";; esac
+ done
+fi
+
# The --host setting is used only when providing --auth_config
# If --kubeconfig is used, the host to use is retrieved from the .kubeconfig
# file and the one provided with --host is ignored.
@@ -183,6 +195,19 @@ case "${E2E_TEST_DEBUG_TOOL:-ginkgo}" in
program+=("--nodes=25")
fi
program+=("${ginkgo_args[@]:+${ginkgo_args[@]}}")
+
+ if [[ -n "${report_dir:-}" ]]; then
+ # The JUnit report written by the E2E suite gets truncated to avoid
+ # overwhelming the tools that need to process it. For manual analysis
+ # it is useful to have the full reports in both formats that Ginkgo
+ # supports:
+ # - JUnit for comparison with the truncated report.
+ # - JSON because it is a faithful representation of
+ # all available information.
+ #
+ # This has to be passed to the CLI, the suite doesn't support --output-dir.
+ program+=("--output-dir=${report_dir}" "--junit-report=ginkgo_report.xml" "--json-report=ginkgo_report.json")
+ fi
;;
delve) program=("dlv" "exec") ;;
gdb) program=("gdb") ;;
diff --git a/test/e2e/framework/test_context.go b/test/e2e/framework/test_context.go
index 6108cddf740..1dee6be4a67 100644
--- a/test/e2e/framework/test_context.go
+++ b/test/e2e/framework/test_context.go
@@ -549,8 +549,8 @@ func writeJUnitReport(report ginkgo.Report) {
trimmedReport.SpecReports = nil
for _, specReport := range report.SpecReports {
// Remove details for any spec that hasn't failed. In Prow,
- // the test output captured in build-log.txt has all of this
- // information, so we don't need it in the XML.
+ // jobs that use ginkgo-e2e.sh will dump the full
+ // information into ginkgo_report.xml/json.
if specReport.State != types.SpecStateFailed {
specReport.CapturedGinkgoWriterOutput = ""
specReport.CapturedStdOutErr = ""