From 732aee957dbd69ef8c1773b4856e8cee1de09ff4 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Dec 04 2017 23:52:37 +0000 Subject: atomic, cloud, docker: correct fedmsgs and bail on fail These changes bring the post-release compose scripts into line with the pre-release ones in a couple of ways. Firstly, they should now include the compose ID in fedmsgs sent after the compose completes. Secondly, they will skip all post-compose tasks (rsyncing and sending 'compose.complete' fedmsgs, and sending out mail reports although that's commented out anyway) when the compose fails. As part of this, we correct the NEWCOMPOSE_ID discovery for these composes. Signed-off-by: Adam Williamson --- diff --git a/cloud-nightly.sh b/cloud-nightly.sh index ee7dc97..4ce413e 100755 --- a/cloud-nightly.sh +++ b/cloud-nightly.sh @@ -38,7 +38,6 @@ else fi # Set up our fedmsg function, using the releng repo definition 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" . ./releng/scripts/fedmsg-functions.sh @@ -59,11 +58,15 @@ else CMD="$CMD --debug-mode --compose-dir=$TARGET_DIR/$COMPOSE_ID" fi time $CMD "$@" -if [ "$?" = "0" ]; then - export mail=0 +if [ "$?" != "0" ]; then + exit 1 fi -NEWCOMPOSE_ID=$(cat $TARGET_DIR/latest-Fedora-27/COMPOSE_ID) + +NEWCOMPOSE_ID=$(cat $TARGET_DIR/latest-Fedora-Cloud-27/COMPOSE_ID) SHORTCOMPOSE_ID=$(echo $NEWCOMPOSE_ID|sed -e 's|Fedora-.*-||g') +fedmsg_json_start=$(printf '{"log": "start", "branch": "%s", "arch": "%s", "compose_id": "%s"}' "$BRANCHED" "$ARCH" "$NEWCOMPOSE_ID") +fedmsg_json_done=$(printf '{"log": "done", "branch": "%s", "arch": "%s", "compose_id": "%s"}' "$BRANCHED" "$ARCH" "$NEWCOMPOSE_ID") + # Set this to use later for a few items include depcheck DESTDIR=$TARGET_DIR/$NEWCOMPOSE_ID $RSYNCPREFIX mkdir -p $DESTDIR @@ -79,9 +82,7 @@ send_fedmsg "${fedmsg_json_start}" ${DIST} rsync.start 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 -# cat $TARGET_DIR/$NEWCOMPOSE_ID/logs/*verbose $DESTDIR/logs/depcheck | \ -# mutt -e "set from=\"$FROM\"" -e 'set envelope_from=yes' -s "$SUBJECT" $tomail -# done -#fi +#for tomail in $TOMAIL ; do +# cat $TARGET_DIR/$NEWCOMPOSE_ID/logs/*verbose $DESTDIR/logs/depcheck | \ +# mutt -e "set from=\"$FROM\"" -e 'set envelope_from=yes' -s "$SUBJECT" $tomail +#done diff --git a/docker-nightly.sh b/docker-nightly.sh index 34a9f20..1a7a3a8 100755 --- a/docker-nightly.sh +++ b/docker-nightly.sh @@ -37,7 +37,6 @@ else fi # Set up our fedmsg function, using the releng repo definition 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" . ./releng/scripts/fedmsg-functions.sh @@ -58,11 +57,15 @@ else CMD="$CMD --debug-mode --compose-dir=$TARGET_DIR/$COMPOSE_ID" fi time $CMD "$@" -if [ "$?" = "0" ]; then - export mail=0 +if [ "$?" != "0" ]; then + exit 1 fi -NEWCOMPOSE_ID=$(cat $TARGET_DIR/latest-Fedora_Docker-26/COMPOSE_ID) + +NEWCOMPOSE_ID=$(cat $TARGET_DIR/latest-Fedora-Docker-26/COMPOSE_ID) SHORTCOMPOSE_ID=$(echo $NEWCOMPOSE_ID|sed -e 's|Fedora-.*-||g') +fedmsg_json_start=$(printf '{"log": "start", "branch": "%s", "arch": "%s", "compose_id": "%s"}' "$BRANCHED" "$ARCH" "$NEWCOMPOSE_ID") +fedmsg_json_done=$(printf '{"log": "done", "branch": "%s", "arch": "%s", "compose_id": "%s"}' "$BRANCHED" "$ARCH" "$NEWCOMPOSE_ID") + DESTDIR=$TARGET_DIR/$NEWCOMPOSE_ID $RSYNCPREFIX mkdir -p $DESTDIR # Tell interested persons that the rsync is starting (zomg!) @@ -76,9 +79,8 @@ send_fedmsg "${fedmsg_json_start}" ${DIST} rsync.start # Tell everyone by fedmsg about the compose send_fedmsg "${fedmsg_json_done}" ${DIST} complete SUBJECT='Fedora '$DIST' compose report: '$SHORTCOMPOSE_ID' changes' -#if [ "$mail" = "0" ]; then -# for tomail in $TOMAIL ; do -# cat $TARGET_DIR/$NEWCOMPOSE_ID/logs/*verbose $DESTDIR/logs/depcheck | \ -# mutt -e "set from=\"$FROM\"" -e 'set envelope_from=yes' -s "$SUBJECT" $tomail -# done -#fi +#for tomail in $TOMAIL ; do +# cat $TARGET_DIR/$NEWCOMPOSE_ID/logs/*verbose $DESTDIR/logs/depcheck | \ +# mutt -e "set from=\"$FROM\"" -e 'set envelope_from=yes' -s "$SUBJECT" $tomail +#done + diff --git a/twoweek-nightly.sh b/twoweek-nightly.sh index a23e88d..d57964a 100755 --- a/twoweek-nightly.sh +++ b/twoweek-nightly.sh @@ -37,7 +37,6 @@ else fi # Set up our fedmsg function, using the releng repo definition 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" . ./releng/scripts/fedmsg-functions.sh @@ -58,11 +57,15 @@ else CMD="$CMD --debug-mode --compose-dir=$TARGET_DIR/$COMPOSE_ID" fi time $CMD "$@" -if [ "$?" = "0" ]; then - export mail=0 +if [ "$?" != "0" ]; then + exit 1 fi + NEWCOMPOSE_ID=$(cat $TARGET_DIR/latest-Fedora-Atomic-27/COMPOSE_ID) SHORTCOMPOSE_ID=$(echo $NEWCOMPOSE_ID|sed -e 's|Fedora-.*-||g') +fedmsg_json_start=$(printf '{"log": "start", "branch": "%s", "arch": "%s", "compose_id": "%s"}' "$BRANCHED" "$ARCH" "$NEWCOMPOSE_ID") +fedmsg_json_done=$(printf '{"log": "done", "branch": "%s", "arch": "%s", "compose_id": "%s"}' "$BRANCHED" "$ARCH" "$NEWCOMPOSE_ID") + DESTDIR=$TARGET_DIR/$NEWCOMPOSE_ID $RSYNCPREFIX mkdir -p $DESTDIR # Tell interested persons that the rsync is starting (zomg!) @@ -77,9 +80,7 @@ send_fedmsg "${fedmsg_json_done}" ${DIST} rsync.complete # Tell everyone by fedmsg about the compose send_fedmsg "${fedmsg_json_done}" ${DIST} complete SUBJECT='Fedora '$DIST' compose report: '$SHORTCOMPOSE_ID' changes' -#if [ "$mail" = "0" ]; then -# for tomail in $TOMAIL ; do -# cat $TARGET_DIR/$NEWCOMPOSE_ID/logs/*verbose $DESTDIR/logs/depcheck | \ -# mutt -e "set from=\"$FROM\"" -e 'set envelope_from=yes' -s "$SUBJECT" $tomail -# done -#fi +#for tomail in $TOMAIL ; do +# cat $TARGET_DIR/$NEWCOMPOSE_ID/logs/*verbose $DESTDIR/logs/depcheck | \ +# mutt -e "set from=\"$FROM\"" -e 'set envelope_from=yes' -s "$SUBJECT" $tomail +#done