-
-
Save jsoref/07beed504e05495f11d8d8fd1712a9ff to your computer and use it in GitHub Desktop.
Local git mirror of github used by private Jenkins
This file contains hidden or 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
So I've installed a dead simple backup, in /home/USER/git_backup/: | |
git clone --mirror [email protected]:USER/PROJECT.git | |
update.sh (launched every 5 minutes by cron): | |
#/bin/sh | |
cd /home/USER/git_backup/PROJECT.git | |
LINES=`git remote update 2>&1 | wc -l` | |
if [ $LINES -eq 1 ]; then | |
# only one line "Fetching origin"? | |
echo "Project didn't changed" | |
else | |
echo "Project changed, notify jenkins builds" | |
curl http://JENKINS:8080/git/[email protected]:USER/PROJECT.git | |
fi | |
This keeps a perfect copy (mirror) of the PROJECT github repository, and if there's a change when doing the "git remote update", jenkins is notified, and it'll then poll github to check if it should run the builds related to the url provided. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment