377cbf7c2a
Fixes: https://pagure.io/releng/issue/9586 Signed-off-by: Mohan Boddu <mboddu@bhujji.com>
77 lines
2.7 KiB
Bash
Executable File
77 lines
2.7 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
|
|
export LC_ALL=C
|
|
|
|
CONFIG="epel8-playground.conf"
|
|
TARGET_DIR="/mnt/koji/compose/epel"
|
|
NIGHTLY="--nightly"
|
|
SKIP_PHASES="--skip-phase=productimg"
|
|
DATE=$(date "+%Y%m%d")
|
|
SHORT="Fedora-Epel-Playground"
|
|
RELEASE="8"
|
|
TMPDIR=`mktemp -d /tmp/$RELEASE.$DATE.XXXX`
|
|
OLDCOMPOSE_ID=$(cat $TARGET_DIR/latest-$SHORT-$RELEASE/COMPOSE_ID)
|
|
RSYNCPREFIX="sudo -u ftpsync"
|
|
RSYNCTARGET="/pub/epel/playground/$RELEASE"
|
|
|
|
# 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/COMPOSE_ID)
|
|
DESTDIR=$TARGET_DIR/$NEWCOMPOSE_ID
|
|
LOCATION="https://dl.fedoraproject.org$RSYNCTARGET"
|
|
|
|
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")
|
|
|
|
send_fedmsg "${fedmsg_json_start}" ${RELEASE} rsync.start
|
|
if [ ! -d "$RSYNCTARGET" ]; then
|
|
mkdir "$RSYNCTARGET"
|
|
fi
|
|
$RSYNCPREFIX compose-partial-copy --arch=aarch64 --arch=ppc64le --arch=s390x --arch=x86_64 --arch src \
|
|
"$DESTDIR" "$RSYNCTARGET/" \
|
|
--variant Everything --exclude=repodata
|
|
|
|
$RSYNCPREFIX compose-partial-copy --arch=aarch64 --arch=ppc64le --arch=s390x --arch=x86_64 --arch src \
|
|
"$DESTDIR" "$RSYNCTARGET/" \
|
|
--variant Everything --delete-after
|
|
|
|
send_fedmsg "${fedmsg_json_done}" ${RELEASE} rsync.complete
|
|
|
|
# Tell everyone by fedmsg about the compose
|
|
send_fedmsg "${fedmsg_json_done}" ${RELEASE} complete
|
|
|
|
# Removed all the older than 14 days composes
|
|
find $TARGET_DIR -xdev -depth -maxdepth 2 -mtime +14 -exec rm -rf {} \;
|
|
send_fedmsg "${fedmsg_json_done}" ${RELEASE} cleanup.complete
|