Last active
June 20, 2016 20:52
-
-
Save derak/2b5d68f745984df19329 to your computer and use it in GitHub Desktop.
AutoPkg build that pipes output to a log file. Build fails if nothing is added to munki.
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/sh | |
/usr/local/bin/autopkg run -v ${JOB_NAME}.munki MakeCatalogs.munki 2>&1 | tee /Users/Shared/Jenkins/tmp/${JOB_NAME}.log | |
RESULT=`grep rebuilt /Users/Shared/Jenkins/tmp/${JOB_NAME}.log` | |
if [ -n "$RESULT" ]; then | |
echo "${JOB_NAME} added to Munki repository. Build successful." | |
exit 0 | |
else | |
echo "Nothing added to munki. Failing the build even though all is well." | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am using job names that are identical to my AutoPkg recipe names, this allows me to use the ${JOB_NAME} variable in Jenkins.