Don't need gsutil on circle; use a prebuild weave-build image and cache it locally.
This commit is contained in:
1 parent
5e5e932584
commit
5ed8ad46ee
2 files changed
+44
-27
No files matched your search
+18
-5
@@ -1,3 +1,8 @@
|
|||||||
|
general:
|
||||||
|
branches:
|
||||||
|
ignore:
|
||||||
|
- gh-pages
|
||||||
|
|
||||||
machine:
|
machine:
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
@@ -6,18 +11,26 @@ machine:
|
|||||||
SRCDIR: /home/ubuntu/src/github.com/weaveworks/weave
|
SRCDIR: /home/ubuntu/src/github.com/weaveworks/weave
|
||||||
PATH: $PATH:$HOME/.local/bin:$HOME/google-cloud-sdk/bin/
|
PATH: $PATH:$HOME/.local/bin:$HOME/google-cloud-sdk/bin/
|
||||||
CLOUDSDK_CORE_DISABLE_PROMPTS: 1
|
CLOUDSDK_CORE_DISABLE_PROMPTS: 1
|
||||||
|
WEAVE_BUILD: $HOME/docker/weave-build.tar
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
|
cache_directories:
|
||||||
|
- "~/docker"
|
||||||
|
override:
|
||||||
|
- if [[ -e "$WEAVE_BUILD" ]]; then
|
||||||
|
docker load -i $WEAVE_BUILD;
|
||||||
|
else
|
||||||
|
docker pull weaveworks/weave-build;
|
||||||
|
mkdir -p $(dirname "$WEAVE_BUILD");
|
||||||
|
docker save weaveworks/weave-build >$WEAVE_BUILD;
|
||||||
|
fi
|
||||||
post:
|
post:
|
||||||
- docker build -t weaveworks/weave-build build
|
|
||||||
- pip install --user --upgrade gcloud gsutil
|
|
||||||
- curl https://sdk.cloud.google.com | bash
|
- curl https://sdk.cloud.google.com | bash
|
||||||
- bin/setup-circleci-secrets "$SECRET_PASSWORD"
|
- bin/setup-circleci-secrets "$SECRET_PASSWORD"
|
||||||
|
|
||||||
test:
|
|
||||||
pre:
|
|
||||||
- mkdir -p $(dirname $SRCDIR)
|
- mkdir -p $(dirname $SRCDIR)
|
||||||
- cp -r $(pwd)/ $SRCDIR
|
- cp -r $(pwd)/ $SRCDIR
|
||||||
|
|
||||||
|
test:
|
||||||
override:
|
override:
|
||||||
- docker run -v /var/run/docker.sock:/run/docker.sock -v /home/ubuntu:/home/go weaveworks/weave-build
|
- docker run -v /var/run/docker.sock:/run/docker.sock -v /home/ubuntu:/home/go weaveworks/weave-build
|
||||||
- cd $SRCDIR/test; ./gce.sh setup
|
- cd $SRCDIR/test; ./gce.sh setup
|
||||||
|
|||||||
+26
-22
@@ -13,17 +13,27 @@ IMAGE=ubuntu-14-04
|
|||||||
TEMPLATE_NAME="test-template"
|
TEMPLATE_NAME="test-template"
|
||||||
ZONE=us-central1-a
|
ZONE=us-central1-a
|
||||||
NUM_HOSTS=2
|
NUM_HOSTS=2
|
||||||
|
SUFFIX=""
|
||||||
|
if [ -n "$CIRCLECI" -a -n "$CIRCLE_SHA1" ]; then
|
||||||
|
SUFFIX="-${CIRCLE_SHA1:0:7}"
|
||||||
|
fi
|
||||||
|
|
||||||
# Setup authentication
|
# Setup authentication
|
||||||
gcloud auth activate-service-account --key-file $KEY_FILE
|
gcloud auth activate-service-account --key-file $KEY_FILE
|
||||||
gcloud config set project $PROJECT
|
gcloud config set project $PROJECT
|
||||||
|
|
||||||
|
function vm_names {
|
||||||
|
local names=
|
||||||
|
for i in $(seq 1 $NUM_HOSTS); do
|
||||||
|
names="host$i$SUFFIX $names"
|
||||||
|
done
|
||||||
|
echo "$names"
|
||||||
|
}
|
||||||
|
|
||||||
# Delete all vms in this account
|
# Delete all vms in this account
|
||||||
function destroy {
|
function destroy {
|
||||||
names="$(gcloud compute instances list --format=yaml | grep "^name\:" | cut -d: -f2 | xargs echo)"
|
names="$(vm_names)"
|
||||||
if [ -n "$names" ]; then
|
gcloud compute instances delete --zone $ZONE -q $names || true
|
||||||
gcloud compute instances delete --zone $ZONE -q $names
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function external_ip {
|
function external_ip {
|
||||||
@@ -53,25 +63,19 @@ EOF
|
|||||||
# Create new set of VMS
|
# Create new set of VMS
|
||||||
function setup {
|
function setup {
|
||||||
destroy
|
destroy
|
||||||
names=
|
names="$(vm_names)"
|
||||||
for i in $(seq 1 $NUM_HOSTS); do
|
|
||||||
names="host$i $names"
|
|
||||||
done
|
|
||||||
|
|
||||||
gcloud compute instances create $names --image $TEMPLATE_NAME --zone $ZONE
|
gcloud compute instances create $names --image $TEMPLATE_NAME --zone $ZONE
|
||||||
gcloud compute config-ssh --ssh-key-file $SSH_KEY_FILE
|
gcloud compute config-ssh --ssh-key-file $SSH_KEY_FILE
|
||||||
|
|
||||||
hosts=
|
for name in $names; do
|
||||||
for i in $(seq 1 $NUM_HOSTS); do
|
hostname="$name.$ZONE.$PROJECT"
|
||||||
name="host$i.$ZONE.$PROJECT"
|
|
||||||
# Add the remote ip to the local /etc/hosts
|
# Add the remote ip to the local /etc/hosts
|
||||||
sudo -- sh -c "echo \"$(external_ip host$i) $name\" >>/etc/hosts"
|
sudo -- sh -c "echo \"$(external_ip $name) $hostname\" >>/etc/hosts"
|
||||||
|
|
||||||
# Add the local ips to the remote /etc/hosts
|
# Add the local ips to the remote /etc/hosts
|
||||||
for j in $(seq 1 $NUM_HOSTS); do
|
for othername in $names; do
|
||||||
ipaddr=$(internal_ip host$j)
|
entry="$(internal_ip $othername) $othername.$ZONE.$PROJECT"
|
||||||
othername="host$j.$ZONE.$PROJECT"
|
ssh -t "$hostname" "sudo -- sh -c \"echo \\\"$entry\\\" >>/etc/hosts\""
|
||||||
entry="$ipaddr $othername"
|
|
||||||
ssh -t $name "sudo -- sh -c \"echo \\\"$entry\\\" >>/etc/hosts\""
|
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@@ -88,10 +92,10 @@ function make_template {
|
|||||||
function hosts {
|
function hosts {
|
||||||
hosts=
|
hosts=
|
||||||
args=
|
args=
|
||||||
for i in $(seq 1 $NUM_HOSTS); do
|
for name in $(vm_names); do
|
||||||
name="host$i.$ZONE.$PROJECT"
|
hostname="$name.$ZONE.$PROJECT"
|
||||||
hosts="$name $hosts"
|
hosts="$hostname $hosts"
|
||||||
args="--add-host=$name:$(internal_ip host$i) $args"
|
args="--add-host=$hostname:$(internal_ip $name) $args"
|
||||||
done
|
done
|
||||||
export SSH=ssh
|
export SSH=ssh
|
||||||
export HOSTS="$hosts"
|
export HOSTS="$hosts"
|
||||||
|
|||||||
Reference in new issue
Block a user