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
7 changes: 7 additions & 0 deletions .ibm/pipelines/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ cleanup() {
log::error "Exited with an error, setting OVERALL_RESULT to 1"
save_overall_result 1
fi
# Write TESTS_PASSED marker to SHARED_DIR for gather-extra/must-gather optimization.
# When present, the openshift/release post-phase steps can skip heavy artifact collection.
if [[ "${OVERALL_RESULT:-1}" == "0" && -n "${SHARED_DIR:-}" ]]; then
touch "${SHARED_DIR}/TESTS_PASSED"
log::info "TESTS_PASSED marker written to ${SHARED_DIR}"
fi

if [[ "${OPENSHIFT_CI}" == "true" ]]; then
log::info "Cleaning up before exiting"
case "$JOB_NAME" in
Expand Down
10 changes: 7 additions & 3 deletions .ibm/pipelines/lib/testing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ testing::check_backstage_running() {
oc get events -n "${namespace}" --sort-by='.lastTimestamp' | tail -20
mkdir -p "${ARTIFACT_DIR}/${namespace}"
cp -a "/tmp/${LOGFILE}" "${ARTIFACT_DIR}/${namespace}/" || true
save_all_pod_logs "${namespace}"
return 1
fi

Expand All @@ -199,7 +198,6 @@ testing::check_backstage_running() {
oc get events -n "${namespace}" --sort-by='.lastTimestamp' | tail -10
mkdir -p "${ARTIFACT_DIR}/${namespace}"
cp -a "/tmp/${LOGFILE}" "${ARTIFACT_DIR}/${namespace}/" || true
save_all_pod_logs "${namespace}"
return 1
}

Expand Down Expand Up @@ -248,7 +246,13 @@ testing::check_and_test() {
save_status_test_failed $CURRENT_DEPLOYMENT true
save_overall_result 1
fi
save_all_pod_logs "$namespace"

# Collect pod logs only on failure to speed up successful PR runs.
if [[ "${STATUS_TEST_FAILED[$CURRENT_DEPLOYMENT]:-}" == "true" || "${STATUS_FAILED_TO_DEPLOY[$CURRENT_DEPLOYMENT]:-}" == "true" ]]; then
save_all_pod_logs "$namespace"
else
log::info "Tests passed — skipping pod log collection for namespace: ${namespace}"
fi
return 0
}

Expand Down
Loading