diff --git a/release-candidate.sh b/release-candidate.sh index b481eb5..f1c6b25 100755 --- a/release-candidate.sh +++ b/release-candidate.sh @@ -1,32 +1,76 @@ #!/bin/sh export LC_ALL=C -LABEL=$1 # Remove the label from arguments. It gets special treatment. Other arguments # to the script are passed to pungi-koji directly. +LABEL=$1 shift CONFIG="fedora-final.conf" -TARGET_DIR="/mnt/koji/compose/26" -#OLD_COMPOSES_DIR="--old-composes=/mnt/fedora_koji/compose/f23 --old-composes=$TARGET_DIR" +FEDORA_VERSION="${LABEL%%_*}" +TARGET_DIR="/mnt/koji/compose/${FEDORA_VERSION}" +#OLD_COMPOSES_DIR="--old-composes=/mnt/fedora_koji/compose/f23 --old-composes=${TARGET_DIR}" NIGHTLY="" SKIP_PHASES="--skip-phase=productimg" DEST=$(pwd) DATE=$(date "+%Y%m%d") -COMPSFILE="comps-f26.xml" -TMPDIR=`mktemp -d /tmp/fedoraRC.$DATE.XXXX` -# uncomment and edit for resuming a failed compose -#COMPOSE_ID="Fedora-23-20150530.n.0" -pushd $TMPDIR +COMPSFILE="comps-f39.xml" +TMPDIR=$(mktemp -d /tmp/fedoraRC."${DATE}".XXXX) +RELEASE="f39" +SHORT="Fedora" +RSYNCPREFIX="sudo -u ftpsync" +RSYNCTARGET="/pub/alt/stage/${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" + +# Set up our fedora messaging function, using the releng repo definition +FEDMSG_MODNAME="compose" +FEDMSG_CERTPREFIX="releng" +. ./releng/scripts/fedora-messaging.sh + +# Announce that we are starting, even though we don't know the compose_id yet.. +fedora_message_json_start=$(printf '{"log": "start", "branch": "%s", "arch": "%s", "short": "%s"}' "$RELEASE" "$ARCH" "$SHORT") +send_fedora_message "${fedora_message_json_start}" ${RELEASE} start + +# Public URL the synced compose will wind up at, we put them in fedora-messaging +LOCATION="https://dl.fedoraproject.org$RSYNCTARGET" + +# Update fedora_message template +fedora_message_json_start=$(printf '{"log": "start", "branch": "%s", "arch": "%s", "short": "%s", "compose_id": "%s", "location"}' "$RELEASE" "$ARCH" "$SHORT" "$LOCATION") +fedora_message_json_done=$(printf '{"log": "done", "branch": "%s", "arch": "%s", "short": "%s", "location": "%s"}' "$RELEASE" "$ARCH" "$SHORT" "$LOCATION") + +pushd "${TMPDIR}" git clone https://pagure.io/fedora-comps.git && { pushd fedora-comps make "${COMPSFILE}" - cp "${COMPSFILE}" $DEST/ + cp "${COMPSFILE}" "${DEST}"/ popd } popd -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 --target-dir=$TARGET_DIR" + +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} --target-dir=${TARGET_DIR}" else - CMD="$CMD --debug-mode --compose-dir=$TARGET_DIR/$COMPOSE_ID" + CMD="${CMD} --debug-mode --compose-dir=${TARGET_DIR}/${COMPOSE_ID}" fi -time $CMD "$@" + +time "$CMD" "$@" + +# Tell interested persons that the rsync is starting +send_fedora_message "${fedora_message_json_start}" ${RELEASE} rsync.start + +if [ ! -d "${RSYNCTARGET}" ]; then + $(RSYNCPREFIX) mkdir -m 750 -p "${RSYNCTARGET}" +fi + +# Note from documentation: +# If multiple composes are run like 1.2, 1.3, add multiple --link-dest arguments above with multiple composes +${RSYNCPREFIX} sh -c 'for dir in Everything Cloud Container Kinoite Labs Modular Server Silverblue Spins Workstation Onyx Sericea metadata; do rsync -avhH ${TARGET_DIR}/${COMPOSE_ID}/compose/$dir/ ${RSYNCTARGET}/$dir/ --link-dest=/pub/fedora/linux/development/${FEDORA_VERSION}/Everything/ --link-dest=${RSYNCTARGET}/Everything/; done' + +${RSYNCPREFIX} chmod 755 "${RSYNCTARGET}" + +# Let interested persons know the rsync is complete +send_fedora_message "${fedora_message_json_done}" ${RELEASE} rsync.complete