Created
February 28, 2012 16:41
-
-
Save cyberswat/1933558 to your computer and use it in GitHub Desktop.
Jenkins job to manage jenkins configs
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
# Move into the jenkins directory | |
cd /var/lib/jenkins | |
#Add all top level xml files. | |
git add *.xml | |
# Add all job config.xml files. | |
git add jobs/*/config.xml | |
# Add all user config.xml files. | |
git add users/*/config.xml | |
# Add all user content files. | |
git add userContent/* | |
# Remove files from the remote repo that have been removed locally. | |
COUNT=`git log --pretty=format: --name-only --diff-filter=B | wc -l` | |
if [ $COUNT -ne 0 ] | |
then git log --pretty=format: --name-only --diff-filter=B | xargs git rm | |
fi | |
# Commit the differences | |
git commit -a -m "Automated commit of jenkins chaos" | |
# Push the commit up to the remote repository. | |
git push origin master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should it really be
git log ... --diff-filter=B
?I get a list of the deleted files when I do
git diff ... --diff-filter=D
.