Last active
November 2, 2015 16:34
-
-
Save fuzzylogiq/a2b922b41aa7d320dfc1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
exec > >(logger -i -t autopkg-build) 2>&1 | |
BUILD_RECIPE_DIR="/dir/with/autopkg/recipenames" | |
EMAIL_ERRORS_TO='blah@acme.com' | |
my_name=$(basename $0) | |
# Allows us to get exit code of autopkg and not tee | |
set -o pipefail | |
echo "$(date) BEGIN AUTOPKG BUILD RUN" | |
for recipe in $(cd ${BUILD_RECIPE_DIR}; ls ); do | |
OUTPUT_FILE=$(mktemp /tmp/${my_name}.XXXXXXXXX) | |
echo "$(date) Autopkg running ${recipe} ... " | |
/usr/local/bin/autopkg run ${recipe} | tee ${OUTPUT_FILE} | |
if [ $? -ne 0 ]; then | |
mail -s "Failed to build ${recipe}" ${EMAIL_ERRORS_TO} < ${OUTPUT_FILE} | |
fi | |
echo "$(date) ... end run of $recipe" | |
rm -f ${OUTPUT_FILE} | |
done | |
echo "$(date) END AUTOPKG BUILD RUN" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Relies on having a dir with files with the same name as recipes you want to run (we use symlinks to recipes/overrides in a separate dir so we can add/remove them easily from the build process)