Skip to content

Instantly share code, notes, and snippets.

@derak
Last active June 20, 2016 20:52
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save derak/2b5d68f745984df19329 to your computer and use it in GitHub Desktop.
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.
#!/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
@derak
Copy link
Author

derak commented Oct 21, 2014

I am using job names that are identical to my AutoPkg recipe names, this allows me to use the ${JOB_NAME} variable in Jenkins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment