Skip to content

Commit 8081847

Browse files
committed
cosmetic: suppress oras 404 noise on cache miss
oras manifest fetch prints "Error response from registry: failed to fetch" on stderr when an artifact has no cached version (404). This is the normal case for fresh/changed artifacts — the caller in artifacts-obtain.sh already reports the miss with a clean display_alert. Capture stderr via temp file; suppress if it contains "not found" (expected cache miss). Any other error (auth, network) is still shown as a warning so real problems aren't hidden.
1 parent d611e91 commit 8081847

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

lib/functions/general/oci-oras.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,20 @@ function oras_get_artifact_manifest() {
160160

161161
oras_has_manifest="no"
162162
# Gotta capture the output & if it failed...
163-
oras_manifest_json="$(run_tool_oras manifest fetch "${extra_params[@]}" "${image_full_oci}")" && oras_has_manifest="yes" || oras_has_manifest="no"
163+
# Capture stderr: a 404 (cache miss) is normal for fresh artifacts —
164+
# suppress oras's "Error response from registry: failed to fetch"
165+
# dump. The caller (artifacts-obtain.sh) already reports the miss
166+
# with a clean display_alert. Any OTHER error (auth, network) is
167+
# still printed so real problems aren't hidden.
168+
local oras_stderr_file
169+
oras_stderr_file=$(mktemp)
170+
oras_manifest_json="$(run_tool_oras manifest fetch "${extra_params[@]}" "${image_full_oci}" 2>"${oras_stderr_file}")" && oras_has_manifest="yes" || oras_has_manifest="no"
171+
local oras_stderr
172+
oras_stderr=$(<"${oras_stderr_file}")
173+
rm -f "${oras_stderr_file}"
174+
if [[ "${oras_has_manifest}" == "no" && -n "${oras_stderr}" && "${oras_stderr}" != *"not found"* ]]; then
175+
display_alert "ORAS manifest fetch error" "${oras_stderr}" "wrn"
176+
fi
164177
display_alert "oras_has_manifest after: ${oras_has_manifest}" "ORAS manifest yes/no" "debug"
165178
display_alert "oras_manifest_json after: ${oras_manifest_json}" "ORAS manifest json" "debug"
166179

0 commit comments

Comments
 (0)