qa/cephadm: derive container image from cephadm release

test_cephadm.sh hardcodes IMAGE_DEFAULT to ceph:main, which breaks
every stable branch whenever main is renamed to a new release. The
mismatch check in cephadm correctly rejects the container because its
release name doesn't match cephadm's own release. This has recurred on
every release transition (squid→tentacle, quincy→reef) without a fix.

Instead of always pulling ceph:main, derive IMAGE_DEFAULT from the
installed cephadm's version output. On stable builds (release type
"stable"), use ceph:<release> so the container matches cephadm. On dev
builds (main branch), fall back to ceph:main as before. The IMAGE_DEFAULT
env var can still be set externally to override.

Fixes: https://tracker.ceph.com/issues/75821
Signed-off-by: Lumir Sliva <61183145+lumir-sliva@users.noreply.github.com>
This commit is contained in:
Lumir Sliva 2026-04-09 17:10:33 +02:00
parent 1d146b4aff
commit db3ba638e9

View File

@ -12,7 +12,6 @@ FSID='00000000-0000-0000-0000-0000deadbeef'
IMAGE_MAIN=${IMAGE_MAIN:-'quay.ceph.io/ceph-ci/ceph:main'}
IMAGE_REEF=${IMAGE_REEF:-'quay.ceph.io/ceph-ci/ceph:reef'}
IMAGE_SQUID=${IMAGE_SQUID:-'quay.ceph.io/ceph-ci/ceph:squid'}
IMAGE_DEFAULT=${IMAGE_MAIN}
OSD_IMAGE_NAME="${SCRIPT_NAME%.*}_osd.img"
OSD_IMAGE_SIZE='6G'
@ -47,6 +46,20 @@ if ! [ -x "$CEPHADM" ]; then
exit 1
fi
# Derive IMAGE_DEFAULT from cephadm's own release so that stable branches
# pull a matching container instead of always using ceph:main.
# See https://tracker.ceph.com/issues/75821
if [ -z "$IMAGE_DEFAULT" ]; then
_ver=$("$CEPHADM" version 2>/dev/null || true)
_release=$(echo "$_ver" | awk '{print $5}')
_type=$(echo "$_ver" | awk '{gsub(/[()]/, "", $6); print $6}')
if [ -n "$_release" ] && [ "$_type" != "dev" ]; then
IMAGE_DEFAULT="quay.ceph.io/ceph-ci/ceph:${_release}"
else
IMAGE_DEFAULT=${IMAGE_MAIN}
fi
fi
# add image to args
CEPHADM_ARGS="$CEPHADM_ARGS --image $IMAGE_DEFAULT"