3
# Script to automate Jenkins config configuration backup to git.
4
# This mostly deals with job config backups - commit other changes
5
# manually (with good commit messages).
9
HOST="ubuntu@android-build.linaro.org"
10
# Auth proxy (-A) is mandatory for push access
15
if [ "$1" = "" ]; then
16
echo "Usage: $0 status|diff|commit"
20
if [ "$1" = "status" ]; then
21
$SSH $HOST "cd /var/lib/jenkins; git status jobs"
22
elif [ "$1" = "status-all" ]; then
23
$SSH $HOST "cd /var/lib/jenkins; git status"
24
elif [ "$1" = "diff" ]; then
25
$SSH $HOST "cd /var/lib/jenkins; git diff jobs" | less
26
elif [ "$1" = "diff-all" ]; then
27
$SSH $HOST "cd /var/lib/jenkins; git diff" | less
28
elif [ "$1" = "commit" ]; then
29
if [ "$2" = "" ]; then
30
msg="Routine jobs update"
31
$SSH $HOST "cd /var/lib/jenkins; git commit -m \"$msg\" jobs"
32
msg="Capture new jobs"
33
$SSH $HOST "cd /var/lib/jenkins; git add jobs; git commit -m \"$msg\" jobs"
35
$SSH $HOST "cd /var/lib/jenkins; git commit -m \"$2\" jobs"
37
elif [ "$1" = "push" ]; then
38
$SSH $HOST "cd /var/lib/jenkins; git push"