From df4595a7dce447bcdf58f08462563932ea67d503 Mon Sep 17 00:00:00 2001 From: Patrik Polakovič Date: Sep 10 2024 14:13:13 +0000 Subject: Fixes to release-candidate script Signed-off-by: Patrik Polakovič --- diff --git a/release-candidate.sh b/release-candidate.sh index 6e86853..0ac05f0 100755 --- a/release-candidate.sh +++ b/release-candidate.sh @@ -12,7 +12,6 @@ export LC_ALL=C FEDORA_VERSION=$1 LABEL=$2 - # Find out which config file to use based on the label. if [[ "$LABEL" = *"Beta"* ]]; then CONFIG="fedora-beta.conf" @@ -42,20 +41,17 @@ DATE=$(date "+%Y%m%d") TMPDIR=$(mktemp -d /tmp/fedoraRC."${DATE}".XXXX) RELEASE="f${FEDORA_VERSION}" SHORT="Fedora" -RSYNCPREFIX="sudo -u ftpsync" -RSYNCTARGET="/pub/alt/stage/${FEDORA_VERSION}_${LABEL}" +RSYNC_PREFIX="sudo -u ftpsync" +RSYNC_TARGET="/pub/alt/stage/${FEDORA_VERSION}_${LABEL}" # Uncomment and edit for resuming a failed compose, e.g. "COMPOSE_ID="Fedora-23-20150530.n.0" # COMPOSE_ID="Fedora-23-20150530.n.0" # Find out if the dry run (-d) option was invoked. DRY_RUN=false -while getopts 'd' opt; do - case "$opt" in - d) DRY_RUN=true ;; - *) echo "Error in command line parsing." >&2 - exit 1 - esac -done + +if [[ $3 == "-d" ]]; then + DRY_RUN=true +fi if "$DRY_RUN"; then printf "THIS IS A DRY RUN.\n\n" @@ -90,29 +86,18 @@ echo "" fedora_message_json_start=$(printf '{"log": "start", "branch": "%s", "short": "%s"}' \ "$RELEASE" "$SHORT") -$CMD_PREFIX send_fedora_message "${fedora_message_json_start} ${RELEASE} start" +$CMD_PREFIX send_fedora_message "${fedora_message_json_start}" ${RELEASE} start echo "" -# The `pungi-koji` script checks out the fedora-comps repository so this can be removed (commented out for now). -#pushd "${TMPDIR}" -#git clone https://pagure.io/fedora-comps.git && { -# pushd fedora-comps -# make "${COMPSFILE}" -# cp "${COMPSFILE}" "${DEST}"/ -# popd -#} -#popd -#echo "" - CMD="pungi-koji --notification-script=/usr/bin/pungi-fedmsg-notification \ --notification-script=pungi-wait-for-signed-ostree-handler \ --config=${CONFIG} --old-composes=${TARGET_DIR} ${OLD_COMPOSES_DIR} ${NIGHTLY} ${SKIP_PHASES} \ --label=${LABEL}" if [ -z "${COMPOSE_ID}" ]; then - CMD="${CMD_PREFIX} ${CMD} --target-dir=${TARGET_DIR}" + CMD=${CMD_PREFIX} "${CMD} --target-dir=${TARGET_DIR}" else - CMD="${CMD_PREFIX} ${CMD} --debug-mode --compose-dir=${TARGET_DIR}/${COMPOSE_ID}" + CMD=${CMD_PREFIX} "${CMD} --debug-mode --compose-dir=${TARGET_DIR}/${COMPOSE_ID}" fi echo "========================================" @@ -121,7 +106,7 @@ echo "" if ! time ${CMD}; then echo "ERROR: Command failed with a non-zero exit status." - "$CMD_PREFIX" exit 1 + $CMD_PREFIX exit 1 echo "" fi echo "" @@ -129,7 +114,7 @@ echo "" # Check if the compose ID exists and exit if it does not. if [ ! -f "${TARGET_DIR}"/latest-$SHORT-"${FEDORA_VERSION}"/COMPOSE_ID ]; then echo "ERROR: No compose ID available." - "$CMD_PREFIX" exit 1 + $CMD_PREFIX exit 1 echo "" fi @@ -139,14 +124,14 @@ if [ -e "${TARGET_DIR}"/latest-$SHORT-"${FEDORA_VERSION}"/COMPOSE_ID ]; then COMPOSE_ID_2=$(cat "${TARGET_DIR}"/latest-$SHORT-"${FEDORA_VERSION}"/COMPOSE_ID) else echo "ERROR: Compose ID not found." - "$CMD_PREFIX" exit 1 + $CMD_PREFIX exit 1 echo "" fi # Check if the compose STATUS exists and exit if it does not. if [ ! -f "/mnt/koji/compose/${FEDORA_VERSION}/${COMPOSE_ID_2}/STATUS" ]; then echo "ERROR: No compose STATUS available." - "$CMD_PREFIX" exit 1 + $CMD_PREFIX exit 1 echo "" fi @@ -158,7 +143,7 @@ echo "Compose ID: ${COMPOSE_ID_2}" echo "Compose status: ${COMPOSE_STATUS}" if [ "$COMPOSE_STATUS" = "DOOMED" ]; then echo "ERROR: The compose status is DOOMED." - "$CMD_PREFIX" exit 1 + $CMD_PREFIX exit 1 echo "" else echo "Proceeding to rsync." @@ -174,20 +159,20 @@ fedora_message_json_done=$(printf '{"log": "done", "branch": "%s", "short": "%s" echo "========================================" echo "LET INTERESTED PERSONS KNOW ABOUT THE COMPOSE." echo "" -$CMD_PREFIX send_fedora_message "${fedora_message_json_done} ${RELEASE} complete" +$CMD_PREFIX send_fedora_message "${fedora_message_json_done}" ${RELEASE} complete echo "" echo "========================================" echo "TELL INTERESTED PERSONS THAT THE RSYNC IS STARTING." echo "" -$CMD_PREFIX send_fedora_message "${fedora_message_json_start} ${RELEASE} rsync.start" +$CMD_PREFIX send_fedora_message "${fedora_message_json_start}" ${RELEASE} rsync.start echo "" echo "========================================" echo "CREATE THE DIRECTORY TARGETED FOR THE COPY (IF IT DOESN'T EXIST)." echo "" -if [ ! -d "${RSYNCTARGET}" ]; then - "${CMD_PREFIX}" "${RSYNCPREFIX}" mkdir -m 750 -p "${RSYNCTARGET}" +if [ ! -d "${RSYNC_TARGET}" ]; then + ${CMD_PREFIX} ${RSYNC_PREFIX} mkdir -m 750 -p "${RSYNC_TARGET}" fi echo "" @@ -198,17 +183,17 @@ ARTIFACTS="Everything Cloud Container Kinoite Labs Server Silverblue Spins \ Workstation Onyx Sericea metadata" for dir in ${ARTIFACTS}; do - ${CMD_PREFIX} "${RSYNCPREFIX} sh -c rsync -avhH ${TARGET_DIR}/${COMPOSE_ID_2}/compose/$dir/ \ -${RSYNCTARGET}/$dir/ --link-dest=/pub/fedora/linux/development/${FEDORA_VERSION}/Everything/ \ ---link-dest=${RSYNCTARGET}/Everything" + ${CMD_PREFIX} "${RSYNC_PREFIX} sh -c rsync -avhH ${TARGET_DIR}/${COMPOSE_ID_2}/compose/$dir/ \ +${RSYNC_TARGET}/$dir/ --link-dest=/pub/fedora/linux/development/${FEDORA_VERSION}/Everything/ \ +--link-dest=${RSYNC_TARGET}/Everything" done echo "" echo "========================================" echo "SET THE PERMISSIONS OF THE SYNCED COMPOSE." echo "" -if [ -d "${RSYNCTARGET}" ]; then - "${CMD_PREFIX}" "${RSYNCPREFIX}" chmod 755 "${RSYNCTARGET}" +if [ -d "${RSYNC_TARGET}" ]; then + ${CMD_PREFIX} "${RSYNC_PREFIX}" chmod 755 "${RSYNC_TARGET}" fi echo "" @@ -224,4 +209,4 @@ echo "${COMPOSE_ID_2} ${LABEL}" >> "${SERIES_DIR}/${SHORT}-${RELEASE}" echo "========================================" echo "LET INTERESTED PERSONS KNOW THAT THE RSYNC IS COMPLETE." echo "" -$CMD_PREFIX send_fedora_message "${fedora_message_json_done} ${RELEASE} rsync.complete" +$CMD_PREFIX send_fedora_message "${fedora_message_json_done}" ${RELEASE} rsync.complete