[releng] buildrawhide: Simplify fedmsg sending
Till Maas
till at fedoraproject.org
Mon Sep 29 19:07:11 UTC 2014
commit fe213ed64e17e47419417aa7371384fe95b74a04
Author: Till Maas <opensource at till.name>
Date: Mon Sep 29 21:02:18 2014 +0200
buildrawhide: Simplify fedmsg sending
scripts/buildrawhide | 82 +++++++++++++------------------------------------
1 files changed, 22 insertions(+), 60 deletions(-)
---
diff --git a/scripts/buildrawhide b/scripts/buildrawhide
index 79a1a94..bbefad7 100755
--- a/scripts/buildrawhide
+++ b/scripts/buildrawhide
@@ -64,13 +64,20 @@ function log()
echo "$(date --utc) build${DIST}: ${message}" >> "${logfile}"
}
+function send_fedmsg()
+{
+ topic="${1}"
+ log="${2}"
+ # Emit a message using bodhi's cert (since we should be running as "masher").
+ echo "{\"log\": \"${log}\", \"branch\": \"$BRANCHED\", \"arch\": \"$ARCH\"}" | fedmsg-logger \
+ --cert-prefix bodhi \
+ --modname compose \
+ --topic "${DIST}.${topic}" \
+ --json-input
+}
+
log "started"
-# Emit a message using bodhi's cert (since we should be running as "masher").
-echo "{\"log\": \"start\", \"branch\": \"$BRANCHED\", \"arch\": \"$ARCH\"}" | fedmsg-logger \
- --cert-prefix bodhi \
- --modname compose \
- --topic rawhide.start \
- --json-input
+send_fedmsg start start
log "blocking retired packages"
./block_retired.py
@@ -96,23 +103,13 @@ mock -r $MOCKCONFIG --uniqueext=$DATE --no-clean --install koji yum createrepo c
log "mock setup /etc/hosts"
mock -r $MOCKCONFIG --uniqueext=$DATE --copyin /etc/hosts /etc/hosts >/dev/null 2>&1 # this reports to fail, but actually works
-# Emit a message using bodhi's cert (since we should be running as "masher").
-echo "{\"log\": \"start\", \"branch\": \"$BRANCHED\", \"arch\": \"$ARCH\"}" | fedmsg-logger \
- --cert-prefix bodhi \
- --modname compose \
- --topic rawhide.mash.start \
- --json-input
+send_fedmsg start mash.start
log "starting mash"
# Drop privs here so that we run as the masher UID
mock -r $MOCKCONFIG --uniqueext=$DATE --unpriv --chroot "mash $MASHOPTS -p $TREEPREFIX/development/rawhide -o /mnt/koji/mash/rawhide-$DATE --compsfile $logdir/comps-rawhide.xml rawhide$EXPANDARCH > $logdir/mash.log 2>&1" || exit 1
-# Emit a message using bodhi's cert (since we should be running as "masher").
-echo "{\"log\": \"done\", \"branch\": \"$BRANCHED\", \"arch\": \"$ARCH\"}" | fedmsg-logger \
- --cert-prefix bodhi \
- --modname compose \
- --topic rawhide.mash.complete \
- --json-input
+send_fedmsg done mash.complete
log "finished mash"
log "starting hardlink"
@@ -129,12 +126,7 @@ log "starting spam-o-matic"
mock -r $MOCKCONFIG --uniqueext=$DATE --unpriv --chroot "/usr/share/mash/spam-o-matic $DEPOPTS /mnt/koji/mash/rawhide-$DATE/rawhide$EXPANDARCH >$logdir/depcheck" &
log "finished spam-o-matic"
-# Emit a message using bodhi's cert (since we should be running as "masher").
-echo "{\"log\": \"start\", \"branch\": \"$BRANCHED\", \"arch\": \"$ARCH\"}" | fedmsg-logger \
- --cert-prefix bodhi \
- --modname compose \
- --topic rawhide.pungify.start \
- --json-input
+send_fedmsg start pungify.start
log "starting critppath generation"
#only run critpath on primary arch
@@ -151,12 +143,7 @@ for basearch in armhfp i386 x86_64 ; do
wait
log "finished pungify"
-# Emit a message using bodhi's cert (since we should be running as "masher").
-echo "{\"log\": \"done\", \"branch\": \"$BRANCHED\", \"arch\": \"$ARCH\"}" | fedmsg-logger \
- --cert-prefix bodhi \
- --modname compose \
- --topic rawhide.pungify.complete \
- --json-input
+send_fedmsg done pungify.complete
log "starting build_composeinfo"
echo "Running build_composeinfo"
@@ -180,12 +167,7 @@ echo "Compose finished at $(date --utc)" >> $logdir/finish
echo >> $logdir/finish
log "finished compose"
-# Emit a message using bodhi's cert (since we should be running as "masher").
-echo "{\"log\": \"start\", \"branch\": \"$BRANCHED\", \"arch\": \"$ARCH\"}" | fedmsg-logger \
- --cert-prefix bodhi \
- --modname compose \
- --topic rawhide.rsync.start \
- --json-input
+send_fedmsg start rsync.start
log "started rawhide compose sync"
# data
@@ -198,12 +180,7 @@ if [ "$?" = "0" ]; then
export mail=0
fi
-# Emit a message using bodhi's cert (since we should be running as "masher").
-echo "{\"log\": \"done\", \"branch\": \"$BRANCHED\", \"arch\": \"$ARCH\"}" | fedmsg-logger \
- --cert-prefix bodhi \
- --modname compose \
- --topic rawhide.rsync.complete \
- --json-input
+send_fedmsg done rsync.complete
log "starting sending email report"
if [ "$mail" = "0" ]; then
@@ -214,12 +191,7 @@ fi
log "finished sending email report"
[ -z "$ARCH" ] && {
-# Emit a message using bodhi's cert (since we should be running as "masher").
-echo "{\"log\": \"start\", \"branch\": \"$BRANCHED\", \"arch\": \"$ARCH\"}" | fedmsg-logger \
- --cert-prefix bodhi \
- --modname compose \
- --topic rawhide.image.start \
- --json-input
+send_fedmsg start image.start
log "started checking out spin-kickstarts"
pushd ../
@@ -235,12 +207,7 @@ log "finished starting building live/arm/cloud images"
popd
popd
-# Emit a message using bodhi's cert (since we should be running as "masher").
-echo "{\"log\": \"done\", \"branch\": \"$BRANCHED\", \"arch\": \"$ARCH\"}" | fedmsg-logger \
- --cert-prefix bodhi \
- --modname compose \
- --topic rawhide.image.complete \
- --json-input
+send_fedmsg done image.complete
}
for koji in arm ppc s390
@@ -255,11 +222,6 @@ do
scripts/srpm-excluded-arch.py -a $arches --path /mnt/koji/mash/rawhide-$DATE/$BRANCHED$EXPANDARCH/source/SRPMS/*/ >$logdir/excludearch-$koji.log
done
-# Emit a message using bodhi's cert (since we should be running as "masher").
-echo "{\"log\": \"done\", \"branch\": \"$BRANCHED\", \"arch\": \"$ARCH\"}" | fedmsg-logger \
- --cert-prefix bodhi \
- --modname compose \
- --topic rawhide.complete \
- --json-input
+send_fedmsg done complete
exit 0
More information about the rel-eng
mailing list