I initialze $JENKINS_HOME
as a git repository with the following .gitignore
file.
#global types to ignore
*.swp
#Only get job configs and ignore other data
!jobs/*
jobs/*/*
!jobs/*/config.xml
#Ignore expanded plugins folders because we only want jpi files
#plugins/*/*
#Ignore all plugins
plugins
#Ignore logs
logs
There is a cron job which automatically updates this repository.
@daily /app/builder/dailycommit.sh
The contents of dailycommit.sh is the following.
#!/bin/bash
#Sam Gleske (sag47)
#Tue Mar 4 14:35:59 EST 2014
#Red Hat Enterprise Linux Server release 6.5 (Santiago)
#Linux 2.6.32-431.3.1.el6.x86_64 x86_64
#GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)
if [ -z "${JENKINS_HOME}" ];then
echo "JENKINS_HOME not set." 1>&2
exit 1
fi
if [ ! "${USER}" = "jboss" ];then
echo "Must be jboss user to run daily commit." 1>&2
exit 1
fi
export PATH="/usr/local/bin:${PATH}"
cd "${JENKINS_HOME}"
git add .
git add -u
git commit -m "daily commit $(date '+%a %m/%d/%Y')"
git push origin master
Possibly useful is https://wiki.jenkins-ci.org/display/JENKINS/SCM+Sync+configuration+plugin