Test/cross-distro: take the images version used to compile composer

After the move of the repo configs to `osbuild/images`, we changed the
way to determine the all available distro repo configs by taking the
last release of 'images'. This turns out to be fragile, especially when
the test case is being run on a "rhel-x.y.0" branch or basically with
any old osbuild-composer binary. It could happen also in Nightly test
pipelines after the devel freeze.

We always compile osbuild-composer binary with debug information, so we
can determine the vendored 'images' version from the binary. We also
always ship repo configs from the same 'images' version in the RPMs.

Therefore modify the test case to check out the 'images' version that
osbuild-composer was compiled with and use repo configs from that
version.

In addition, don't reduce the depth when cloning the images repository,
because even 200 commits may be too little on some older RHEL ZStream
branches.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2025-04-23 15:33:21 +02:00 committed by Achilleas Koutsou
parent ad68e81f1f
commit c587e723a9

View file

@ -99,12 +99,19 @@ else
echo "All installed distros are recognized by composer."
fi
# set path to all "images" repositories, do not use "main" here but the
# last release version (this assume 200 commits since the last tag)
git clone --depth 200 http://github.com/osbuild/images
( cd images &&
git checkout "$(git describe --tags "$(git rev-list --tags --max-count=1)")"
)
# determine the 'osbuild/images' repository version used by the osbuild-composer
sudo dnf install -y golang
COMPOSER_DEPS=$(go version -m /usr/libexec/osbuild-composer/osbuild-composer)
IMAGES_VERSION=$(echo "$COMPOSER_DEPS" | sed -n 's|^\t\+dep\t\+github\.com/osbuild/images\t\+\(v[0-9.]\+\)\t\+$|\1|p')
if [ -z "$IMAGES_VERSION" ]; then
echo "ERROR: Unable to determine osbuild/images version from osbuild-composer binary. Composer deps:"
echo "$COMPOSER_DEPS"
exit 1
fi
greenprint "INFO: Using osbuild/images version to check repo configs: $IMAGES_VERSION"
git clone http://github.com/osbuild/images
( cd images && git checkout "$IMAGES_VERSION" )
REPO_PATH="images/data/repositories/"
# ALL_DISTROS - all possible distros from upstream repository