Worker/koji-finalize: include osbuild version in image metadata

Include the osbuild version used to build the image, in the image extra
metadata attached to the Koji build and image output.

Extend `koji.sh` to verify that the version is set and of the expected
value.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2023-09-22 17:26:15 +02:00 committed by Tomáš Hozza
parent dcb66db5e7
commit f6e0e99391
3 changed files with 13 additions and 0 deletions

View file

@ -120,6 +120,9 @@ function verify_buildinfo() {
local buildid="${1}"
local target_cloud="${2:-none}"
local osbuild_version
osbuild_version="$(osbuild --version | cut -d ' ' -f 2 -)"
local extra_build_metadata
# extract the extra build metadata JSON from the output
extra_build_metadata="$(koji -s "${KOJI_HUB_URL}" --noauth call --json getBuild "${buildid}" | jq -r '.extra')"
@ -243,6 +246,13 @@ function verify_buildinfo() {
exit 1
fi
local image_osbuild_version
image_osbuild_version="$(echo "${image_metadata_build}" | jq -r '.osbuild_version')"
if [ "${image_osbuild_version}" != "${osbuild_version}" ]; then
echo "Unexpected osbuild version for '${image_filename}'. Expected '${osbuild_version}', but got '${image_osbuild_version}'"
exit 1
fi
local image_metadata_archive
image_metadata_archive="$(echo "${image}" | jq -r '.extra.image')"
if [ "${image_metadata_build}" != "${image_metadata_archive}" ]; then