[AMD] Restrict CI image fallback to versioned tags (#28263)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -173,11 +173,17 @@ find_latest_image() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# If still not found, try finding any image matching ROCm+arch from remote registry
|
# Docker Hub's `name=` filter is fuzzy; only accept official version tags.
|
||||||
echo "Exact version not found. Searching remote registry for any ${ROCM_VERSION}-${gpu_arch} image…" >&2
|
echo "Exact version not found. Searching remote registry for versioned ${ROCM_VERSION}-${gpu_arch} images…" >&2
|
||||||
for days_back in {0..6}; do
|
for days_back in {0..6}; do
|
||||||
local target_date=$(date -d "${days_back} days ago" +%Y%m%d)
|
local target_date=$(date -d "${days_back} days ago" +%Y%m%d)
|
||||||
remote_tags=$(curl -s "https://registry.hub.docker.com/v2/repositories/rocm/sgl-dev/tags?page_size=100&name=${ROCM_VERSION}-${gpu_arch}-${target_date}" 2>/dev/null | grep -o '"name":"[^"]*"' | cut -d'"' -f4 | head -n 1 || true)
|
local sgl_tag_regex="^v[0-9][A-Za-z0-9._-]*-${ROCM_VERSION}-${gpu_arch}-${target_date}$"
|
||||||
|
remote_tags=$(curl -s "https://registry.hub.docker.com/v2/repositories/rocm/sgl-dev/tags?page_size=100&name=${ROCM_VERSION}-${gpu_arch}-${target_date}" 2>/dev/null | grep -o '"name":"[^"]*"' | cut -d'"' -f4 | while read -r tag; do
|
||||||
|
if [[ "${tag}" =~ ${sgl_tag_regex} ]]; then
|
||||||
|
echo "${tag}"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done || true)
|
||||||
if [[ -n "$remote_tags" ]]; then
|
if [[ -n "$remote_tags" ]]; then
|
||||||
echo "Found available image: rocm/sgl-dev:${remote_tags}" >&2
|
echo "Found available image: rocm/sgl-dev:${remote_tags}" >&2
|
||||||
echo "rocm/sgl-dev:${remote_tags}"
|
echo "rocm/sgl-dev:${remote_tags}"
|
||||||
@@ -185,9 +191,14 @@ find_latest_image() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "No recent images found. Searching any cached local images matching ROCm+arch…" >&2
|
echo "No recent images found. Searching cached local versioned images matching ROCm+arch…" >&2
|
||||||
local any_local
|
local any_local
|
||||||
any_local=$(docker images --format '{{.Repository}}:{{.Tag}}' --filter "reference=rocm/sgl-dev:*${ROCM_VERSION}*${gpu_arch}*" | sort -r | head -n 1)
|
any_local=$(docker images --format '{{.Repository}}:{{.Tag}}' --filter "reference=rocm/sgl-dev:v*-${ROCM_VERSION}-${gpu_arch}-*" | while read -r image; do
|
||||||
|
local tag="${image#rocm/sgl-dev:}"
|
||||||
|
if [[ "${tag}" =~ ^v[0-9][A-Za-z0-9._-]*-${ROCM_VERSION}-${gpu_arch}-[0-9]{8}$ ]]; then
|
||||||
|
echo "${image}"
|
||||||
|
fi
|
||||||
|
done | sort -r | head -n 1)
|
||||||
if [[ -n "$any_local" ]]; then
|
if [[ -n "$any_local" ]]; then
|
||||||
echo "Using cached fallback image: ${any_local}" >&2
|
echo "Using cached fallback image: ${any_local}" >&2
|
||||||
echo "${any_local}"
|
echo "${any_local}"
|
||||||
|
|||||||
@@ -156,11 +156,17 @@ find_latest_image() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# If still not found, try finding any image matching ROCm+arch from remote registry
|
# Docker Hub's `name=` filter is fuzzy; only accept official version tags.
|
||||||
echo "Exact version not found. Searching remote registry for any ${ROCM_VERSION}-${gpu_arch} image…" >&2
|
echo "Exact version not found. Searching remote registry for versioned ${ROCM_VERSION}-${gpu_arch} images…" >&2
|
||||||
for days_back in {0..6}; do
|
for days_back in {0..6}; do
|
||||||
local target_date=$(date -d "${days_back} days ago" +%Y%m%d)
|
local target_date=$(date -d "${days_back} days ago" +%Y%m%d)
|
||||||
remote_tags=$(curl -s "https://registry.hub.docker.com/v2/repositories/rocm/sgl-dev/tags?page_size=100&name=${ROCM_VERSION}-${gpu_arch}-${target_date}" 2>/dev/null | grep -o '"name":"[^"]*"' | cut -d'"' -f4 | head -n 1 || true)
|
local sgl_tag_regex="^v[0-9][A-Za-z0-9._-]*-${ROCM_VERSION}-${gpu_arch}-${target_date}$"
|
||||||
|
remote_tags=$(curl -s "https://registry.hub.docker.com/v2/repositories/rocm/sgl-dev/tags?page_size=100&name=${ROCM_VERSION}-${gpu_arch}-${target_date}" 2>/dev/null | grep -o '"name":"[^"]*"' | cut -d'"' -f4 | while read -r tag; do
|
||||||
|
if [[ "${tag}" =~ ${sgl_tag_regex} ]]; then
|
||||||
|
echo "${tag}"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done || true)
|
||||||
if [[ -n "$remote_tags" ]]; then
|
if [[ -n "$remote_tags" ]]; then
|
||||||
echo "Found available image: rocm/sgl-dev:${remote_tags}" >&2
|
echo "Found available image: rocm/sgl-dev:${remote_tags}" >&2
|
||||||
echo "rocm/sgl-dev:${remote_tags}"
|
echo "rocm/sgl-dev:${remote_tags}"
|
||||||
@@ -168,9 +174,14 @@ find_latest_image() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "No recent images found. Searching any cached local images matching ROCm+arch…" >&2
|
echo "No recent images found. Searching cached local versioned images matching ROCm+arch…" >&2
|
||||||
local any_local
|
local any_local
|
||||||
any_local=$(docker images --format '{{.Repository}}:{{.Tag}}' --filter "reference=rocm/sgl-dev:*${ROCM_VERSION}*${gpu_arch}*" | sort -r | head -n 1)
|
any_local=$(docker images --format '{{.Repository}}:{{.Tag}}' --filter "reference=rocm/sgl-dev:v*-${ROCM_VERSION}-${gpu_arch}-*" | while read -r image; do
|
||||||
|
local tag="${image#rocm/sgl-dev:}"
|
||||||
|
if [[ "${tag}" =~ ^v[0-9][A-Za-z0-9._-]*-${ROCM_VERSION}-${gpu_arch}-[0-9]{8}$ ]]; then
|
||||||
|
echo "${image}"
|
||||||
|
fi
|
||||||
|
done | sort -r | head -n 1)
|
||||||
if [[ -n "$any_local" ]]; then
|
if [[ -n "$any_local" ]]; then
|
||||||
echo "Using cached fallback image: ${any_local}" >&2
|
echo "Using cached fallback image: ${any_local}" >&2
|
||||||
echo "${any_local}"
|
echo "${any_local}"
|
||||||
|
|||||||
Reference in New Issue
Block a user