aboutsummaryrefslogtreecommitdiff
path: root/control/deploy-jenkins-config
blob: a50fcb783be362aba04b39782cc6ba18cf7dbd05 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
###############################################################################
# Copyright (c) 2011 Linaro
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
###############################################################################
#
# This scripts deploys jenkins config
#

set -e
TSTAMP=`date '+%Y%m%dT%H%M'`
# be sure to execute in deployment dir
cd

function header() {
    echo "======================================"
    echo $1
    echo "======================================"
}

if [[ `bzr lp-login` =~ "No Launchpad user" ]]; then
    echo "You must configure your Launchpad ID using bzr lp-login"
    exit 1
fi
echo "Launchpad ID: " `bzr lp-login`

header "Deploying jenkins-config"
sudo service jenkins stop

if [ -d jenkins-config ]; then
    sudo mv jenkins-config jenkins-config.$TSTAMP
fi

#bzr branch lp:~linaro-automation/linaro-android/jenkins-config
git clone ssh://paul.sokolovsky@linaro-private.git.linaro.org/srv/linaro-private.git.linaro.org/linaro-infrastructure/jenkins-config-android-build.linaro.org.git jenkins-config
sudo chown -R jenkins jenkins-config/

if [ -d /var/lib/jenkins ]; then
    sudo mv /var/lib/jenkins /var/lib/jenkins.orig
fi

sudo ln -s $PWD/jenkins-config /var/lib/jenkins

# We no longer keep plugins aka binary blobs in config repo,
# so need to preserve those.
if [ -d /var/lib/jenkins.orig/plugins ]; then
    sudo cp -a /var/lib/jenkins.orig/plugins /var/lib/jenkins
fi

# Override frontend user's password based on this install
sudo linaro-android-build-tools/control/set-jenkins-user-passwd \
    /var/lib/jenkins/users/frontend/config.xml /var/lib/linaro-abs-frontend/jenkins-password

sudo service jenkins start