Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,18 @@ collect_artifacts() {
cp -a node_modules/.cache/e2e-test-results "${ARTIFACT_DIR}/" 2>&1 || echo "[WARNING] e2e-test-results not found"
fi
# Copy JUnit results to SHARED_DIR for data-router step
# Gzip to stay under Kubernetes Secret 1 MiB limit (raw XML can exceed it)
if [[ -f "playwright-report/junit-results.xml" ]]; then
cp "playwright-report/junit-results.xml" "${SHARED_DIR}/"
echo "[INFO] Copied junit-results.xml to ${SHARED_DIR}/"
gzip -c "playwright-report/junit-results.xml" > "${SHARED_DIR}/junit-results.xml.gz"
local gz_size
gz_size=$(stat -c%s "${SHARED_DIR}/junit-results.xml.gz" 2>/dev/null || stat -f%z "${SHARED_DIR}/junit-results.xml.gz")
local max_size=$((800 * 1024))
if (( gz_size > max_size )); then
echo "[WARNING] junit-results.xml.gz is $(( gz_size / 1024 )) KB, exceeds $(( max_size / 1024 )) KB limit. Removing from SHARED_DIR to prevent Secret update failure."
rm -f "${SHARED_DIR}/junit-results.xml.gz"
else
echo "[INFO] Copied junit-results.xml.gz to ${SHARED_DIR}/ ($(( gz_size / 1024 )) KB)"
fi
fi
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ ref:
timeout: 3h30m0s
resources:
limits:
memory: 8Gi
cpu: "4"
cpu: "10"
memory: 5Gi
requests:
cpu: "2"
memory: 6Gi
cpu: "1"
memory: 1Gi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash

# This post step must never fail the overall CI job — it is a reporting step.
# errexit is disabled so errors are handled internally (retries, warnings, graceful skips).
set +o errexit
set +o nounset

# Skip data router reporting when job was triggered via Gangway API with overrides
OVERRIDE_VARS=(
Expand Down Expand Up @@ -87,16 +88,27 @@ get_artifacts_url() {
process_junit_file() {
echo "Processing JUnit file for Data Router compatibility..."

local junit_file="${SHARED_DIR}/junit-results.xml"
if [[ ! -f "$junit_file" ]]; then
mkdir -p "${ARTIFACT_DIR}/data-router"

local junit_gz="${SHARED_DIR}/junit-results.xml.gz"
local junit_shared="${SHARED_DIR}/junit-results.xml"
local junit_file="${ARTIFACT_DIR}/data-router/junit-results.xml"

# Decompress gzipped junit to ARTIFACT_DIR (new format); fall back to plain XML (backward compat)
if [[ -f "$junit_gz" ]]; then
gunzip -c "$junit_gz" > "$junit_file"
echo "Decompressed junit-results.xml.gz -> ${junit_file}"
elif [[ -f "$junit_shared" ]]; then
cp "$junit_shared" "$junit_file"
echo "Copied junit-results.xml from SHARED_DIR to ARTIFACT_DIR"
else
echo "WARNING: junit-results.xml not found in ${SHARED_DIR}, skipping processing"
return
fi

echo "Processing: junit-results.xml"

# Create backup in ARTIFACT_DIR
mkdir -p "${ARTIFACT_DIR}/data-router"
cp "$junit_file" "${ARTIFACT_DIR}/data-router/junit-results.xml.original.xml"

# Construct artifacts URL for attachment placeholder replacement
Expand Down Expand Up @@ -253,9 +265,10 @@ main() {
local output=""
local DATA_ROUTER_REQUEST_ID=""

if [[ ! -f "${SHARED_DIR}/junit-results.xml" ]]; then
echo "ERROR: No JUnit results file (junit-results.xml) found in ${SHARED_DIR}"
return
local junit_for_send="${ARTIFACT_DIR}/data-router/junit-results.xml"
if [[ ! -f "$junit_for_send" ]]; then
echo "WARNING: No JUnit results file found (processed by process_junit_file), skipping Data Router upload"
return 0
fi

for ((i = 1; i <= max_attempts; i++)); do
Expand All @@ -265,7 +278,7 @@ main() {
--url "${DATA_ROUTER_URL}" \
--username "${DATA_ROUTER_USERNAME}" \
--password "${DATA_ROUTER_PASSWORD}" \
--results "${SHARED_DIR}/junit-results.xml" \
--results "$junit_for_send" \
--verbose --wirelog 2>&1) && \
DATA_ROUTER_REQUEST_ID=$(echo "$output" | grep "request:" | awk '{print $2}') &&
[ -n "$DATA_ROUTER_REQUEST_ID" ]; then
Expand Down Expand Up @@ -320,3 +333,6 @@ main() {
}

main

# Ensure this reporting step never fails the CI job regardless of what main() returned
exit 0
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash

# This post step must never fail the overall CI job — it is a reporting step.
# errexit is disabled so errors are handled internally (retries, warnings, graceful skips).
set +o errexit
set +o nounset

# Skip data router reporting when job was triggered via Gangway API with overrides
OVERRIDE_VARS=(
Expand Down Expand Up @@ -96,7 +97,30 @@ get_artifacts_url() {
process_junit_files() {
echo "📝 Processing JUnit files for Data Router compatibility..."

for junit_file in "${SHARED_DIR}"/junit-results-*.xml; do
mkdir -p "${ARTIFACT_DIR}/data-router"

# Decompress gzipped junit files to ARTIFACT_DIR (new format); copy plain XML as fallback (backward compat)
for junit_gz in "${SHARED_DIR}"/junit-results-*.xml.gz; do
if [[ -f "$junit_gz" ]]; then
local filename
filename=$(basename "${junit_gz%.gz}")
gunzip -c "$junit_gz" > "${ARTIFACT_DIR}/data-router/${filename}"
echo "Decompressed $(basename "$junit_gz") -> ${ARTIFACT_DIR}/data-router/${filename}"
fi
done
for junit_shared in "${SHARED_DIR}"/junit-results-*.xml; do
if [[ -f "$junit_shared" ]]; then
local filename
filename=$(basename "$junit_shared")
# Only copy if not already decompressed from .gz
if [[ ! -f "${ARTIFACT_DIR}/data-router/${filename}" ]]; then
cp "$junit_shared" "${ARTIFACT_DIR}/data-router/${filename}"
echo "Copied ${filename} from SHARED_DIR to ARTIFACT_DIR"
fi
fi
done

for junit_file in "${ARTIFACT_DIR}"/data-router/junit-results-*.xml; do
if [[ ! -f "$junit_file" ]]; then
continue
fi
Expand Down Expand Up @@ -204,9 +228,9 @@ save_data_router_metadata() {
--arg name "$JOB_NAME" \
--arg description "[View job run details](${JOB_URL})" \
--arg job_type "$JOB_TYPE" \
--arg pr "$GIT_PR_NUMBER" \
--arg pr "${GIT_PR_NUMBER:-}" \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Preserve PR metadata from PULL_NUMBER when GIT_PR_NUMBER is absent.

This file already uses PULL_NUMBER to detect PR jobs, but the new default emits an empty pr attribute when only PULL_NUMBER is set.

Proposed fix
-    --arg pr "${GIT_PR_NUMBER:-}" \
+    --arg pr "${GIT_PR_NUMBER:-${PULL_NUMBER:-}}" \
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
--arg pr "${GIT_PR_NUMBER:-}" \
--arg pr "${GIT_PR_NUMBER:-${PULL_NUMBER:-}}" \
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@ci-operator/step-registry/redhat-developer/rhdh/send/data-router/redhat-developer-rhdh-send-data-router-commands.sh`
at line 231, The `redhat-developer-rhdh-send-data-router-commands.sh` PR
metadata argument is only reading `GIT_PR_NUMBER`, which leaves `pr` empty when
the job is identified by `PULL_NUMBER` instead. Update the `--arg pr` value in
the data-router command assembly to fall back to `PULL_NUMBER` when
`GIT_PR_NUMBER` is unset, while keeping the existing PR-job detection logic
consistent. Use the same PR metadata handling path in this script so the emitted
`pr` attribute is preserved for both environment variable sources.

--arg job_name "$JOB_NAME" \
--arg tag_name "$TAG_NAME" \
--arg tag_name "${TAG_NAME:-}" \
--arg install_method "$install_method" \
--arg cluster_type "$cluster_type" \
--arg container_platform "$CONTAINER_PLATFORM" \
Expand Down Expand Up @@ -270,25 +294,25 @@ main() {
for ((i = 1; i <= max_attempts; i++)); do
echo "Attempt ${i} of ${max_attempts} to send test results through Data Router."

# Check if JUnit results files exist in SHARED_DIR
# Check if JUnit results files exist in ARTIFACT_DIR (decompressed by process_junit_files)
local junit_files_found=false
for file in "${SHARED_DIR}"/junit-*.xml; do
for file in "${ARTIFACT_DIR}"/data-router/junit-*.xml; do
if [[ -f "$file" ]]; then
junit_files_found=true
break
fi
done

if [[ "$junit_files_found" == false ]]; then
echo "ERROR: No JUnit results files (junit-*.xml) found in ${SHARED_DIR}"
return
echo "WARNING: No JUnit results files (junit-*.xml) found in ${ARTIFACT_DIR}/data-router, skipping Data Router upload"
return 0
fi

if output=$(droute send --metadata "$(get_metadata_output_path)" \
--url "${DATA_ROUTER_URL}" \
--username "${DATA_ROUTER_USERNAME}" \
--password "${DATA_ROUTER_PASSWORD}" \
--results "${SHARED_DIR}/junit-*.xml" \
--results "${ARTIFACT_DIR}/data-router/junit-*.xml" \
--verbose --wirelog 2>&1) && \
DATA_ROUTER_REQUEST_ID=$(echo "$output" | grep "request:" | awk '{print $2}') &&
[ -n "$DATA_ROUTER_REQUEST_ID" ]; then
Expand Down Expand Up @@ -349,3 +373,6 @@ main() {
}

main

# Ensure this reporting step never fails the CI job regardless of what main() returned
exit 0