Skip to content

Instantly share code, notes, and snippets.

@smat
Created August 10, 2012 08:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smat/3312576 to your computer and use it in GitHub Desktop.
Save smat/3312576 to your computer and use it in GitHub Desktop.
Jenkins backup
#
# 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*
#!/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