Created
August 10, 2012 08:18
-
-
Save smat/3312576 to your computer and use it in GitHub Desktop.
Jenkins backup
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
# | |
# The following ignores... | |
# Miscellaneous Jenkins litter | |
*.log | |
*.tmp | |
*.old | |
*.bak | |
*.jar | |
*.json | |
# Generated Jenkins state | |
/.owner | |
/secret.key | |
/queue.xml | |
/fingerprints/ | |
/shelvedProjects/ | |
/updates/ | |
cache/ | |
# Tools that Jenkins manages | |
/tools/ | |
# Extracted plugins | |
plugins/ | |
# monitoring plugin files | |
monitoring/ | |
# Job state | |
builds/ | |
workspace/ | |
lastStable | |
lastSuccessful | |
nextBuildNumber | |
modules/ | |
/jobs/*/clover/history/ | |
# Maven | |
.m2/ | |
.java/ | |
# Build specific | |
backup/ | |
war/ | |
# Environment | |
.bash* | |
.netrc | |
.ssh* | |
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 | |
# Based on https://gist.github.com/1919354 | |
# Storing jenkins Configs in Github | |
# * create a .gitignore file in your $JENKINS_HOME with the following | |
# ** this may need tuning to your liking | |
# ** ie storing artifacts etc | |
export https_proxy=http://proxyserver/ | |
export JENKINS_HOME="/var/data/jenkins" | |
export GIT_AUTHOR_NAME="Jenkins build server" | |
export GIT_AUTHOR_EMAIL="jenkins@mail.com" | |
export GIT_COMMITTER_NAME="Jenkins build server" | |
export GIT_COMMITTER_EMAIL="jenkins@mail.com" | |
# Jenkins Configuraitons Directory | |
cd $JENKINS_HOME | |
# Add any new files | |
git add . | |
# mark as deleted anything that's been, well, deleted | |
to_remove=`git status | grep "deleted" | awk '{print $3}'` | |
# | |
if [ -n "$to_remove" ]; then | |
git rm --ignore-unmatch $to_remove | |
fi | |
git commit -am "Automated Jenkins commit" | |
git push -q origin master | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment