[ROCm][CI] Accept `base-v2-preview` images during content hash lookup for ROCm base images (#56356)

Signed-off-by: Micah Williamson <micah.williamson@amd.com>

Micah Williamson committed Sep 11, 2026 at 02:30 UTC a9271c750f6eb07ad7e4c52b9dffa65ff2ee336a
1 file changed +7 -3
.buildkite/scripts/rocm/refresh-base-image.sh
+7 -3
@@ -384,6 +384,7 @@ build_base_image() {
384 local stable_tag="${BASE_REPO}:base"
385 local trusted_content_tag=""
386 local scoped_content_tag=""
387 + local preview_content_tag=""
388 local writable_content_tag=""
389 local build_ref=""
390 local immutable_ref=""
@@ -431,6 +432,7 @@ build_base_image() {
432 dependency_summary="base=${base_image_arg},rocm=${rocm_version},python=${python_version_arg},pytorch=${pytorch_arg},torchvision=${pytorch_vision_arg},torchaudio=${pytorch_audio_arg},triton=${triton_arg},flash-attn=${fa_arg},aiter=${aiter_arg},mori=${mori_arg},pytorch-rocm-arch=${pytorch_rocm_arch_arg}"
433 trusted_content_tag=$(trusted_base_content_ref "${base_hash}" "${metadata_version}")
434 scoped_content_tag=$(scoped_base_content_ref "${base_hash}" "${metadata_version}")
435 + preview_content_tag="${scoped_content_tag}"
436 # Preview writes share an exact-content namespace so stacked PRs can reuse
437 # identical images. They may import the trusted ref, but never overwrite it.
438 if is_trusted_main_build; then
@@ -471,7 +473,8 @@ build_base_image() {
473 if [[ "${trusted_content_tag}" == "${scoped_content_tag}" ]]; then
474 immutable_ref=$(find_matching_base_content_ref \
475 "${base_hash}" "${metadata_version}" \
474 - "${trusted_content_tag}" "${stable_tag}") || reuse_status=$?
476 + "${trusted_content_tag}" "${preview_content_tag}" \
477 + "${stable_tag}") || reuse_status=$?
478 else
479 immutable_ref=$(find_matching_base_content_ref \
480 "${base_hash}" "${metadata_version}" \
@@ -490,8 +493,9 @@ build_base_image() {
493
494 if [[ ${reuse_status} -eq 0 && -n "${immutable_ref}" ]]; then
495 echo "Reusing ROCm base image with matching content: ${immutable_ref}"
493 - if [[ "${immutable_ref%@*}" == "${stable_tag}" \
494 - && "${writable_content_tag}" != "${stable_tag}" ]]; then
496 + if [[ "${immutable_ref%@*}" != "${writable_content_tag}" \
497 + && ( "${immutable_ref%@*}" == "${stable_tag}" \
498 + || "${immutable_ref%@*}" == "${preview_content_tag}" ) ]]; then
499 echo "Backfilling ROCm base content tag: ${writable_content_tag}"
500 docker buildx imagetools create --prefer-index=false \
501 -t "${writable_content_tag}" "${immutable_ref}"