Skip to content

Commit

Permalink
chore(ci): log datarouter errors in the OpenShift CI ARTIFACT_DIR
Browse files Browse the repository at this point in the history
Skip PR build for changes limited to e2e folder or existing image (redhat-developer#2135)

Add steps to detect PRs with changes only in the `e2e/` folder and skip the build in such cases. Additionally, check if the image already exists in Quay.io and bypass the build if it does. This reduces unnecessary builds, improving efficiency in the CI workflow.
  • Loading branch information
zdrapela committed Jan 16, 2025
1 parent beb54c6 commit d969b0c
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions .ibm/pipelines/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,24 +103,31 @@ droute_send() {
&& chmod +x /tmp/droute-linux-amd64 \
&& /tmp/droute-linux-amd64 version"

# Initialize Data Router logging
ARTIFACT_DIR=${ARTIFACT_DIR:-/tmp/artifacts}
echo "ARTIFACT_DIR = ${ARTIFACT_DIR}"
mkdir -p "${ARTIFACT_DIR}/datarouter-errors"
# Send test results through DataRouter and save the request ID.
local max_attempts=5
local wait_seconds=1
for ((i = 1; i <= max_attempts; i++)); do
echo "Attempt ${i} of ${max_attempts} to send test results through Data Router."
if output=$(oc exec -n "${droute_project}" "${droute_pod_name}" -- /bin/bash -c "
output=$(oc exec -n "${droute_project}" "${droute_pod_name}" -- /bin/bash -c "
/tmp/droute-linux-amd64 send --metadata ${temp_droute}/${metadata_output} \
--url '${DATA_ROUTER_URL}' \
--username '${DATA_ROUTER_USERNAME}' \
--password '${DATA_ROUTER_PASSWORD}' \
--results '${temp_droute}/${JUNIT_RESULTS}' \
--verbose" 2>&1); then
if DATA_ROUTER_REQUEST_ID=$(echo "$output" | grep "request:" | awk '{print $2}') &&
[ -n "$DATA_ROUTER_REQUEST_ID" ]; then
echo "Test results successfully sent through Data Router."
echo "Request ID: $DATA_ROUTER_REQUEST_ID"
break
fi
--verbose" 2>&1)
# Log output to artifact directory
log_file="${ARTIFACT_DIR}/datarouter-errors/attempt_${i}.log"
echo "${output}" > "${log_file}"
echo "droute send logs written to ${log_file}"

if DATA_ROUTER_REQUEST_ID=$(echo "$output" | grep "request:" | awk '{print $2}') &&
[ -n "$DATA_ROUTER_REQUEST_ID" ]; then
echo "Test results successfully sent through Data Router."
echo "Request ID: $DATA_ROUTER_REQUEST_ID"
break
fi

if ((i == max_attempts)); then
Expand All @@ -131,6 +138,7 @@ droute_send() {
echo "1. Restart $droute_pod_name in $droute_project project/namespace"
echo "2. Check the Data Router documentation: https://spaces.redhat.com/pages/viewpage.action?pageId=115488042"
echo "3. Ask for help at Slack: #forum-dno-datarouter"
break
fi
done

Expand Down

0 comments on commit d969b0c

Please # to comment.