pungi-fedora/nightly-modular.sh
Adam Williamson 93bf27c8f2 Emit 'location' key in fedmsgs, pointing to compose URL
For fedmsg_meta we have to provide a 'link'. At present we do
this with a rather large and icky pile of conditionals which
doesn't work properly. It's much simpler to figure out the URL
in the compose script and emit it in the fedmsg, then meta can
just...use it. For older fedmsgs we'll just point to the base
kojipkgs location for the link.

For synced composes, we use the synced URL on dl (this matches
what the meta stuff tried to do before). For non-synced composes
we just use the kojipkgs location.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2018-01-25 11:00:52 +01:00

110 lines
4.2 KiB
Bash
Executable File

#!/bin/sh
#set -x
export LC_ALL=C
CONFIG="fedora-modular.conf"
TARGET_DIR="/mnt/koji/compose/"
#OLD_COMPOSES_DIR="--old-composes=/mnt/fedora_koji/compose/f23 --old-composes=$TARGET_DIR"
NIGHTLY="--nightly"
SKIP_PHASES="--skip-phase=productimg"
DEST=$(pwd)
DATE=$(date "+%Y%m%d")
SHORT="Fedora-Modular"
RELEASE="bikeshed"
RELEASE_TITLE="Bikeshed"
TMPDIR=`mktemp -d /tmp/$RELEASE.$DATE.XXXX`
TOMAIL="devel@lists.fedoraproject.org test@lists.fedoraproject.org"
FROM="Fedora Rawhide Report <rawhide@fedoraproject.org>"
RSYNCPREFIX="sudo -u ftpsync"
RSYNCTARGET="/pub/fedora/linux/modular/development/$RELEASE"
OLDCOMPOSE_ID=$(cat $TARGET_DIR/latest-$SHORT-$RELEASE_TITLE/COMPOSE_ID)
# assume a releng dir is a git checkout of the releng repo
# if it does not exist clone it
if [ -d releng ]; then
pushd releng
git pull --rebase
popd
else
git clone https://pagure.io/releng.git
fi
# Set up our fedmsg function, using the releng repo definition
FEDMSG_MODNAME="compose"
FEDMSG_CERTPREFIX="releng"
. ./releng/scripts/fedmsg-functions.sh
# Announce that we are starting, even though we don't know the compose_id yet..
fedmsg_json_start=$(printf '{"log": "start", "branch": "%s", "arch": "%s", "short": "%s"}' "$RELEASE" "$ARCH" "$SHORT")
send_fedmsg "${fedmsg_json_start}" ${RELEASE} start
CMD="pungi-koji --notification-script=/usr/bin/pungi-fedmsg-notification --config=$CONFIG --old-composes=$TARGET_DIR $OLD_COMPOSES_DIR $NIGHTLY $SKIP_PHASES"
if [ -z "$COMPOSE_ID" ]; then
CMD="$CMD --target-dir=$TARGET_DIR"
else
CMD="$CMD --debug-mode --compose-dir=$TARGET_DIR/$COMPOSE_ID"
fi
time $CMD "$@"
if [ "$?" != "0" ]; then
exit 1
fi
NEWCOMPOSE_ID=$(cat $TARGET_DIR/latest-$SHORT-$RELEASE_TITLE/COMPOSE_ID)
SHORTCOMPOSE_ID=$(echo $NEWCOMPOSE_ID|sed -e 's|Fedora-Modular.*-||g')
# Set this to use later for a few items include depcheck
DESTDIR=$TARGET_DIR/$NEWCOMPOSE_ID
# Public URL the synced compose will wind up at, we put it in fedmsgs
LOCATION="https://dl.fedoraproject.org/$RSYNCTARGET"
# Update fedmsg template
fedmsg_json_start=$(printf '{"log": "start", "branch": "%s", "arch": "%s", "short": "%s", "compose_id": "%s", "location": "%s"}' "$RELEASE" "$ARCH" "$SHORT" "$NEWCOMPOSE_ID", "$LOCATION")
fedmsg_json_done=$(printf '{"log": "done", "branch": "%s", "arch": "%s", "short": "%s", "compose_id": "%s", "location": "%s"}' "$RELEASE" "$ARCH" "$SHORT" "$NEWCOMPOSE_ID" "$LOCATION")
compose-changelog -p $TARGET_DIR/$NEWCOMPOSE_ID/logs/ $TARGET_DIR/$OLDCOMPOSE_ID/ $TARGET_DIR/$NEWCOMPOSE_ID/
# Figure out a version for broken deps e-mail that goes to package maintainers.
# For Bikeshed it's just bikeshed, for branched versions we prepend F- to the number.
if [ "$RELEASE" = "bikeshed" ]; then
TREENAME="$RELEASE"
else
TREENAME="F-$RELEASE"
fi
/usr/share/mash/spam-o-matic --nomail --treename="$TREENAME" "$DESTDIR/compose/Server/" >"$DESTDIR/logs/depcheck"
# Tell interested persons that the rsync is starting (zomg!)
send_fedmsg "${fedmsg_json_start}" ${RELEASE} rsync.start
# Sync the content to /pub/fedora
if [ ! -d "$RSYNCTARGET" ]; then
mkdir "$RSYNCTARGET"
fi
$RSYNCPREFIX compose-partial-copy --arch=armhfp --arch=x86_64 --arch=aarch64 --arch=ppc64 --arch=ppc64le --arch=s390x --arch src \
"$TARGET_DIR/$NEWCOMPOSE_ID" "$RSYNCTARGET/" \
--variant Server \
--exclude=repodata
$RSYNCPREFIX compose-partial-copy --arch=armhfp --arch=x86_64 --arch=aarch64 --arch=ppc64 --arch=ppc64le --arch=s390x --arch src \
"$TARGET_DIR/$NEWCOMPOSE_ID" "$RSYNCTARGET/" \
--variant Server \
--delete-after
$RSYNCPREFIX rm "$RSYNCTARGET/.composeinfo"
$RSYNCPREFIX ./releng/scripts/build_composeinfo "$RSYNCTARGET/" --name "$NEWCOMPOSE_ID"
# Tell interested persons that the rsync is done.
send_fedmsg "${fedmsg_json_done}" ${RELEASE} rsync.complete
# Tell everyone by fedmsg about the compose
send_fedmsg "${fedmsg_json_done}" ${RELEASE} complete
# Tell everyone by email about the compose
SUBJECT='Fedora Modular '$RELEASE' compose report: '$SHORTCOMPOSE_ID' changes'
for tomail in $TOMAIL ; do
cat $TARGET_DIR/$NEWCOMPOSE_ID/logs/*verbose | \
mutt -e "set from=\"$FROM\"" -e 'set envelope_from=yes' -s "$SUBJECT" $tomail
done
# Remove old composes older than 14 days
find $TARGET_DIR/$SHORT-$RELEASE_TITLE* -xdev -depth -maxdepth 2 -mtime +14 -exec rm -rf {} \;