From 0fda47c2ef7afbbb41aabd4006a656c33f4ff1a4 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: May 08 2024 12:10:25 +0000 Subject: [PATCH 1/2] Add script to push containers to registries Add script to push containers to registries, run the script at the end of the compose process to push the container manifests to the fedora container registries. Signed-off-by: Peter Robinson --- diff --git a/sync-bootc-base-containers.sh b/sync-bootc-base-containers.sh new file mode 100755 index 0000000..7e9b0e1 --- /dev/null +++ b/sync-bootc-base-containers.sh @@ -0,0 +1,177 @@ +#!/bin/bash + +set -x + +# +# Sync latest docker image +# +# Docs in the f_help function +f_ctrl_c() { + printf "\n*** Exiting ***\n" + exit $? +} +# trap int (ctrl-c) +trap f_ctrl_c SIGINT +f_help() { + cat < /dev/null + # Import the image + for arch in "${ARCHES[@]}"; do + local filename + filename="/mnt/koji/compose/iot/Fedora-IoT-${release}-${compdate}/compose/bootc/${arch}/images/${basename}-${compose}.ociarchive" + copy_image ${format}:${filename} ${registry_name}:${release}-${arch} + done + + popd &> /dev/null + + generate_manifest_list ${registry_name} ${release} + printf "Removing temporary directory\n" + rm -rf $work_dir +} + +# +# Version should not be higher than rawhide +# Either there is a mistake or script is out of date +# +if [[ ${1} -gt "$current_rawhide" ]]; then + printf "ERROR: VERSION HIGHER THAN RAWHIDE" + exit 1 +fi + +# For fedora-bootc +if [[ -n ${base_build_nvr} ]]; then + find_and_copy_images ${base_build_nvr} fedora-bootc ${1} ${compose} +fi diff --git a/twoweek-nightly.sh b/twoweek-nightly.sh index 95a15fd..12b3f82 100755 --- a/twoweek-nightly.sh +++ b/twoweek-nightly.sh @@ -69,6 +69,8 @@ for dir in IoT metadata ; $RSYNCPREFIX rsync -avhH --delete-after $DESTDIR/compose/$dir/ "$RSYNCTARGET/$dir/" ; $RSYNCPREFIX ./releng/scripts/build_composeinfo "$RSYNCTARGET/" --name $NEWCOMPOSE_ID done +# Push containers +./sync-bootc-base-containers.sh ${RELEASE} ${LABEL} # Tell interested persons that the rsync is done. send_fedmsg "${fedmsg_json_done}" ${RELEASE} rsync.complete # Tell everyone by fedmsg about the compose From f7a61386b47d93250d1efeac2ce7e7b2ee1de12f Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: May 08 2024 12:10:34 +0000 Subject: [PATCH 2/2] Improve container version detection process Some minor improvements around container version and release detection. Signed-off-by: Peter Robinson --- diff --git a/sync-bootc-base-containers.sh b/sync-bootc-base-containers.sh index 7e9b0e1..f2272f9 100755 --- a/sync-bootc-base-containers.sh +++ b/sync-bootc-base-containers.sh @@ -69,6 +69,7 @@ fi basename="Fedora-IoT-bootc" format="oci-archive" +vers=${1} compose=${2} compdate=`echo ${compose} | cut -c 4-` @@ -78,7 +79,7 @@ compdate=`echo ${compose} | cut -c 4-` # Can't currently query koji for runroot tasks as they're not tagged # # base_build_nvr=$(koji -q latest-build --type=image f${1}-updates-candidate ${basename} | awk '{print $1}') -base_build_nvr=${basename}-${compose} +base_build_nvr=${basename}-${vers}-${compdate} if [[ ${1} -eq "$current_stable" ]]; then tagname="latest" @@ -140,8 +141,8 @@ find_and_copy_images() { exit 1 fi # Check both architectures completed in the build else exit - if [ ! -f "/mnt/koji/compose/iot/Fedora-IoT-${release}-${compdate}/compose/bootc/x86_64/images/${basename}-${compose}.ociarchive" ] && \ - [ ! -f "/mnt/koji/compose/iot/Fedora-IoT-${release}-${compdate}/compose/bootc/aarch64/images/${basename}-${compose}.ociarchive" ]; then + if [ ! -f "/mnt/koji/compose/iot/Fedora-IoT-${release}-${compdate}/compose/bootc/x86_64/images/${basename}-${release}.${compdate}.ociarchive" ] && \ + [ ! -f "/mnt/koji/compose/iot/Fedora-IoT-${release}-${compdate}/compose/bootc/aarch64/images/${basename}-${release}.${compdate}.ociarchive" ]; then echo "One of the expected images are missing, exiting." exit 1 fi @@ -151,7 +152,7 @@ find_and_copy_images() { # Import the image for arch in "${ARCHES[@]}"; do local filename - filename="/mnt/koji/compose/iot/Fedora-IoT-${release}-${compdate}/compose/bootc/${arch}/images/${basename}-${compose}.ociarchive" + filename="/mnt/koji/compose/iot/Fedora-IoT-${release}-${compdate}/compose/bootc/${arch}/images/${basename}-${release}.${compdate}.ociarchive" copy_image ${format}:${filename} ${registry_name}:${release}-${arch} done @@ -171,7 +172,9 @@ if [[ ${1} -gt "$current_rawhide" ]]; then exit 1 fi +printf "Syncing compose contailers: ${vers} : ${compose}\n" + # For fedora-bootc if [[ -n ${base_build_nvr} ]]; then - find_and_copy_images ${base_build_nvr} fedora-bootc ${1} ${compose} + find_and_copy_images ${base_build_nvr} fedora-bootc ${vers} ${compose} fi