blob: 2fcf5b470a15e7acda4ec741a938030fc66eda43 (
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
|
#!/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
###############################################################################
#
# Create cloud-buildd sandbox from scratch
#
set -e
if [ "$1" == "" -o "$1" == "-h" -o "$1" == "--help" ]; then
echo "$0 - Create cloud-buildd sandbox in the cloud"
echo "Usage: $0 <ec2 keypair name> [--config=linaro]"
echo " if --config=linaro given, use production Jenkins config snapshot,"
echo " otherwise leave Jenkins bare."
exit
fi
if [ -z "$EC2_PRIVATE_KEY" -o -z "$EC2_CERT" ]; then
echo "Error: EC2_PRIVATE_KEY and/or EC2_CERT environment variables must be defined"
exit 1
fi
. sandbox-create.conf
. start-instance --include
ec2_start_instance "$1" "$AMI" "$INSTANCE_TYPE" "$SECURITY_GROUPS" "$AVAILABILITY_ZONE"
echo "Instance ID: $instance_id"
echo "Hostname: $instance_hostname"
./setup-control-node-via-ssh $instance_hostname $BUILD_TOOLS_BRANCH
if [ "$2" == "--config=linaro" ]; then
# Make sure to pre-auth bazaar.launchpad.net, because otherwise
# we'll later get "Host key verification failed." when running
# commands non-interactively.
ssh -A ubuntu@$instance_hostname <<EOF
ssh-keyscan bazaar.launchpad.net >>~/.ssh/known_hosts
ssh-keyscan linaro-private.git.linaro.org >>~/.ssh/known_hosts
bzr lp-login pfalcon
linaro-android-build-tools/control/deploy-jenkins-config
echo "Waiting for Jenkins start up..."
sleep 60
cd linaro-android-build-tools/utils/mangle-jobs
sudo ./mangle-jobs reset-cron.mangle --user=frontend --passwd-file=/var/lib/linaro-abs-frontend/jenkins-password --really
EOF
fi
echo
echo "--------------------------"
echo "Sandbox creation complete, open link below in browser:"
echo "https://$instance_hostname"
|