Some start/stop fedmsg messages wrapped around nightly.sh.

As well as fedmsg notify on rsync start/stop.

Signed-off-by: Ralph Bean <rbean@redhat.com>
This commit is contained in:
Ralph Bean 2016-03-03 13:04:11 -05:00
parent b519942d4c
commit e23a5f736d
2 changed files with 55 additions and 0 deletions

36
fedmsg-functions.sh Normal file
View File

@ -0,0 +1,36 @@
# fedmsg-functions
#
# This is a bash shell script that is meant to be sourced by other scripts
# and aims to deliver functions common to sending messages to fedmsg[0]
# in rel-eng shell scripts.
#
# [0] - http://www.fedmsg.com/en/latest/
# NOTES:
# - Scripts that source this should define at least the following:
# FEDMSG_MODNAME
# FEDMSG_CERTPREFIX
#
# Example:
#
# FEDMSG_MODNAME="compose"
# FEDMSG_CERTPREFIX="bodhi"
# source ./scripts/fedmsg-functions.sh
#
# fedmsg_json_start=$(printf '{"log": "start", "branch": "f24", "arch": "x86_64"}')
# send_fedmsg "${fedmsg_json_start}" f24 start
function send_fedmsg()
{
jsoninput="${1}"
dist="${2}"
topic="${3}"
echo ${jsoninput} | fedmsg-logger \
--cert-prefix ${FEDMSG_CERTPREFIX} \
--modname ${FEDMSG_MODNAME} \
--topic "${dist}.${topic}" \
--json-input
}

View File

@ -27,6 +27,16 @@ OLDCOMPOSE_ID=$(cat $TARGET_DIR/latest-Fedora-/COMPOSE_ID)
# uncomment and edit for resuming a failed compose
#COMPOSE_ID="Fedora-23-20150530.n.0"
# Set up our fedmsg function
fedmsg_json_start=$(printf '{"log": "start", "branch": "%s", "arch": "%s"}' "$BRANCHED" "$ARCH")
fedmsg_json_done=$(printf '{"log": "done", "branch": "%s", "arch": "%s"}' "$BRANCHED" "$ARCH")
FEDMSG_MODNAME="compose"
FEDMSG_CERTPREFIX="releng"
. ./fedmsg-functions.sh
# Announce that we are starting...
send_fedmsg "${fedmsg_json_start}" ${DIST} start
# assume a releng dir is a git checkout of teh releng repo
# if it does not exist clone it
if [ -d releng ]; then
@ -100,6 +110,8 @@ compose-changelog -p $TARGET_DIR/$NEWCOMPOSE_ID/logs/ $TARGET_DIR/$OLDCOMPOSE_ID
./releng/scripts/critpath.py --url file://$DESTDIR/compose/Everything -o $DESTDIR/logs/critpath.txt branched &> $DESTDIR/logs/critpath.log
}
# Tell interested persons that the rsync is starting (zomg!)
send_fedmsg "${fedmsg_json_start}" ${DIST} rsync.start
for dir in Everything Atomic CloudImages Docker Server Spins Workstation ;
do
@ -113,6 +125,13 @@ for dir in Cloud Labs ;
$RSYNCPREFIX rsync -avhH $TARGET_DIR/$NEWCOMPOSE_ID/compose/$dir/ /pub/alt/development/$DIST/$dir/ --link-dest=/pub/fedora/linux/development/$DIST/Everything/ --delete-after ;
done
# Tell interested persons that the rsync is done.
send_fedmsg "${fedmsg_json_done}" ${DIST} rsync.complete
# Tell everyone by fedmsg about the compose
send_fedmsg "${fedmsg_json_done}" ${DIST} complete
# Tell everyone by email about the compose
SUBJECT='Fedora '$DIST' compose report: '$SHORTCOMPOSE_ID' changes'
if [ "$mail" = "0" ]; then
for tomail in $TOMAIL ; do