blob: 68e9a3033dcdaa9ffc192ff6f2e599f16dcc3bb2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#!/bin/sh
#
# Script to automate Jenkins config configuration backup to git.
# This mostly deals with job config backups - commit other changes
# manually (with good commit messages).
#
set -x
HOST="ubuntu@android-build.linaro.org"
# Auth proxy (-A) is mandatory for push access
SSH_OPTS="-A"
SSH="ssh $SSH_OPTS"
if [ "$1" = "" ]; then
echo "Usage: $0 status|diff|commit"
exit 1
fi
if [ "$1" = "status" ]; then
$SSH $HOST "cd /var/lib/jenkins; git status jobs"
elif [ "$1" = "status-all" ]; then
$SSH $HOST "cd /var/lib/jenkins; git status"
elif [ "$1" = "diff" ]; then
$SSH $HOST "cd /var/lib/jenkins; git diff jobs" | less
elif [ "$1" = "diff-all" ]; then
$SSH $HOST "cd /var/lib/jenkins; git diff" | less
elif [ "$1" = "commit" ]; then
if [ "$2" = "" ]; then
msg="Routine jobs update"
$SSH $HOST "cd /var/lib/jenkins; git commit -m \"$msg\" jobs"
msg="Capture new jobs"
$SSH $HOST "cd /var/lib/jenkins; git add jobs; git commit -m \"$msg\" jobs"
else
$SSH $HOST "cd /var/lib/jenkins; git commit -m \"$2\" jobs"
fi
elif [ "$1" = "push" ]; then
$SSH $HOST "cd /var/lib/jenkins; git push"
fi
|