-
-
Save ralph-tice/9842bbddd68b1797b63f to your computer and use it in GitHub Desktop.
version control jenkins and jobs
this shell snippet itself can be used as a jenkins job and it will add itself.
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
cd /var/lib/jenkins | |
git add userContent/* -f | |
git add jobs/*/*.xml -f | |
git add users/*/config.xml -f | |
git add *.xml | |
COUNT=`git ls-files --deleted | wc -l` | |
if [ $COUNT -ne 0 ] | |
then git ls-files --deleted | xargs -d '\n' git rm | |
fi | |
git commit -m "autocommit by jenkins job because $BUILD_CAUSE" | |
# Push the commit up to the remote repository. | |
git push origin jenkins |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated with a bug fix -- previous version didn't delete correctly.