#!/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 [--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 <>~/.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"