add mail notifications

This commit is contained in:
Louis Abel 2023-01-17 23:02:17 -07:00
parent 545d4b15e7
commit 0967cfd68e
Signed by: label
GPG Key ID: B37E62D143879B36
5 changed files with 116 additions and 65 deletions

View File

@ -1,50 +0,0 @@
image_build = {
"^BaseOS$": [
{
"image-build": {
"format": [("qcow2", "qcow2")],
"name": "Rocky-8-GenericCloud",
"subvariant": "generic",
"version": "8.8",
"release": "!RELEASE_FROM_DATE_RESPIN"
"target": "image-rocky-8",
"ksurl": "git+https://git.rockylinux.org/rocky/kickstarts.git?#origin/r8",
"kickstart": "Rocky-8-GenericCloud-Base.ks",
"ksversion": "F26",
"distro": "Fedora-20",
"disk-size": "10",
"arches": ["x86_64","aarch64"],
"install_tree_from": "BaseOS",
"repo": ["BaseOS","AppStream",]
},
"factory-parameters": {
"generate_icicle": False,
}
},
{
"image-build": {
"format": [("raw.xz", "raw.xz")],
"name": "Rocky-8-ec2",
"subvariant": "ec2",
"version": "8.8",
"release": "!RELEASE_FROM_DATE_RESPIN"
"target": "image-rocky-8",
"ksurl": "git+https://git.rockylinux.org/rocky/kickstarts.git?#origin/r8",
"kickstart": "Rocky-8-EC2-Base.ks",
"ksversion": "F26",
"distro": "Fedora-20",
"disk-size": "10",
"arches": ["x86_64", "aarch64"],
"install_tree_from": "BaseOS",
"repo": ["BaseOS","AppStream",]
},
"factory-parameters": {
"generate_icicle": False,
}
},
]
}
translate_paths = [
("/mnt/koji", "https://koji.rockylinux.org/kojifiles"),
]

View File

@ -1,13 +1,59 @@
global_ksurl = 'git+https://git.resf.org/sig_core/kickstarts.git?#origin/r8'
live_media = {
'^Workstation$': [
{
'name': 'Rocky-Workstation-8',
'version': '8.8',
'arches': ['x86_64'],
'kickstart': 'Rocky-8-Workstation.ks',
'repo': ['BaseOS', 'AppStream', 'PowerTools', 'extras'],
'failable': ['*']
#global_ksurl = 'git+https://git.resf.org/sig_core/kickstarts.git?#origin/r8'
#live_media = {
# '^Workstation$': [
# {
# 'name': 'Rocky-Workstation-8',
# 'version': '8.8',
# 'arches': ['x86_64'],
# 'kickstart': 'Rocky-8-Workstation.ks',
# 'repo': ['BaseOS', 'AppStream', 'PowerTools', 'extras'],
# 'failable': ['*']
# }
# ]
#}
image_build = {
"^BaseOS$": [
{
"image-build": {
"format": [("qcow2", "qcow2")],
"name": "Rocky-8-GenericCloud",
"subvariant": "generic",
"version": "8.8",
"release": "!RELEASE_FROM_DATE_RESPIN"
"target": "image-rocky-8",
"ksurl": "git+https://git.resf.org/sig_core/kickstarts.git?#origin/r8",
"kickstart": "Rocky-8-GenericCloud-Base.ks",
"ksversion": "F26",
"distro": "Fedora-20",
"disk-size": "10",
"arches": ["x86_64","aarch64"],
"install_tree_from": "BaseOS",
"repo": ["BaseOS","AppStream",]
},
"factory-parameters": {
"generate_icicle": False,
}
]
},
{
"image-build": {
"format": [("raw.xz", "raw.xz")],
"name": "Rocky-8-EC2",
"subvariant": "ec2",
"version": "8.8",
"release": "!RELEASE_FROM_DATE_RESPIN"
"target": "image-rocky-8",
"ksurl": "git+https://git.resf.org/sig_core/kickstarts.git?#origin/r8",
"kickstart": "Rocky-8-EC2-Base.ks",
"ksversion": "F26",
"distro": "Fedora-20",
"disk-size": "10",
"arches": ["x86_64", "aarch64"],
"install_tree_from": "BaseOS",
"repo": ["BaseOS","AppStream",]
},
"factory-parameters": {
"generate_icicle": False,
}
},
]
}

View File

@ -1,5 +1,7 @@
# Overrides default variables
from images import *
sigkeys = ['6D745A60']
tree_arches = ['aarch64', 'i386', 'x86_64']
translate_paths = [

View File

@ -1 +1,28 @@
MAJOR="8"
REVISION="8.8"
FROMMAIL="Compose Tracker <releng@rockylinux.org>"
TOMAIL="releng@rockylinux.org"
if ! which mm-compose-notif > /dev/null 2>&1; then
MM_NOTIF=""
else
MM_NOTIF="$(which mm-compose-notif)"
fi
if ! which compose-changelog > /dev/null 2>&1; then
if [ -f "/home/$(whoami)/.local/bin/compose-changelog" ]; then
CHANGELOG_CMD="/home/$(whoami)/.local/bin/compose-changelog"
else
CHANGELOG_CMD=""
fi
else
CHANGELOG_CMD="$(which compose-changelog)"
fi
if ! which mutt > /dev/null 2>&1; then
MAILCMD=""
MAILNOTIF="no"
else
MAILCMD="$(which mutt)"
MAILNOTIF="yes"
fi

View File

@ -3,16 +3,14 @@
source "$(dirname "$0")/common-8"
export PATH=/usr/sbin:/usr/bin:/root/bin
TARGET_DIR="/mnt/compose/8-LookAhead"
LOG_DIR="/mnt/compose/logs"
SHORT=Rocky
CONFIG=/etc/pungi-lh/rockylh.conf
# Unused for now
OLDCOMPOSE_ID=$(cat $TARGET_DIR/latest-$SHORT-8/COMPOSE_ID)
OLDCOMPOSE_ID="$(cat $TARGET_DIR/latest-$SHORT-$MAJOR/COMPOSE_ID)"
SKIP=""
#LABEL="--nightly --label RC-${REVISION}"
LABEL="--test"
CMD="pungi-koji --config=$CONFIG $SKIP $LABEL"
#COMPOSE_ID="Rocky-8-20210625.n.0"
if [ -z "$COMPOSE_ID" ]; then
CMD="$CMD --target-dir=$TARGET_DIR"
@ -21,3 +19,31 @@ else
fi
time $CMD
ret_val=$?
if [[ "$ret_val" != "0" ]]; then
if [[ "$MAILNOTIF" == "yes" ]]; then
echo "This is a notification that a recent $SHORT compose failed on $(hostname)" | mutt -e "set from=\"$FROM\"" \
-e 'set envelope_from=yes' \
-s "Compose $NEWCOMPOSE_ID failed (for Rocky Linux $REVISION)" \
releng@rockylinux.org
fi
exit 1
fi
NEWCOMPOSE_ID="$(cat $TARGET_DIR/latest-$SHORT-$MAJOR/COMPOSE_ID)"
SHORTCOMPOSE_ID="$(echo $NEWCOMPOSE_ID | sed -e 's|Rocky-.*-||g')"
# attempt to check changelog
if [ -n "$CHANGELOG_CMD" ]; then
if ! $CHANGELOG_CMD -p "$LOG_DIR/" "$TARGET_DIR/$OLDCOMPOSE_ID/" "$TARGET_DIR/$NEWCOMPOSE_ID" 2>"$LOG_DIR/changelog.$SHORTCOMPOSE_ID.stderr"; then
if [[ "$MAILNOTIF" == "yes" ]]; then
mutt -e "set from=\"$FROM\"" \
-e 'set envelope_from=yes' \
-s "Changelog for $NEWCOMPOSE_ID failed" \
releng@rockylinux.org < "$LOG_DIR/changelog.$SHORTCOMPOSE_ID.stderr"
else
echo "!! Changelog run failed !!"
fi
fi
fi