Change CircleCI config to 2.0 version

Environment variables are moved out to a script, because CircleCI 2.0
does not support expansion of '$foo' in 'env' section.
This commit is contained in:
Bryan Boreham committed 2018-07-30 10:16:18 +00:00
1 parent fc77e33d1d
commit 8620d0ae4f
6 files changed
+76 -67

No files matched your search

+51 -66
View File
@@ -1,66 +1,51 @@
general: version: 2
branches: jobs:
ignore: build:
- gh\-pages machine:
image: circleci/classic:201709-01
machine: environment:
pre: GOPATH: /home/circleci
- curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | bash -s -- 1.10.0 SRCDIR: /home/circleci/src/github.com/weaveworks/weave
services: CIRCLE_ARTIFACTS: /tmp/artifacts
- docker parallelism: 2
environment: steps:
GOPATH: /home/ubuntu:$GOPATH - checkout
SRCDIR: /home/ubuntu/src/github.com/weaveworks/weave - run: mkdir $CIRCLE_ARTIFACTS
PATH: $PATH:$HOME/.local/bin:/opt/google-cloud-sdk/bin # copy source dir and submodule update --init
CLOUDSDK_CORE_DISABLE_PROMPTS: 1 - run: bin/circle-dependencies-post-sources
STATE: /home/ubuntu/state.env - restore_cache:
# Base name of VMs for integration tests: key: v1-cache-{{ checksum "build/Dockerfile" }}-{{ checksum "build/build.sh" }}
NAME: test-$CIRCLE_BUILD_NUM-$CIRCLE_NODE_INDEX # kick off creation of test VMs
TEST_VMS_SETUP_OUTPUT_FILE: $CIRCLE_ARTIFACTS/test_vms_setup_output.txt - run:
TEST_VMS_PROV_AND_CONF_LOCK_FILE: $CIRCLE_ARTIFACTS/test_vms_provisioned_and_configured.txt command: bin/provision_test_vms.sh
TEST_VMS_READY_LOCK_FILE: $CIRCLE_ARTIFACTS/test_vms_ready.txt background: true
# Google Cloud Platorm images for integration tests: # create build image and make all
USE_IMAGE: 1 - run: bin/circle-dependencies-post
DISK_NAME_PREFIX: test-$CIRCLE_BUILD_NUM-0 - save_cache:
key: v1-cache-{{ checksum "build/Dockerfile" }}-{{ checksum "build/build.sh" }}
dependencies: paths:
cache_directories: - "~/docker"
- "~/docker" # when VMs are ready, copy built software to them
post: - run:
- bin/circle-dependencies-post-sources command: bin/circle-test-pre
# Provision & configure testing VMs: background: true
- "while [ ! -d $SRCDIR ]; do sleep 1; done; $SRCDIR/bin/provision_test_vms.sh": - run: bin/circle-test-unit
parallel: true - run:
background: true command: bin/circle-test-smoke
- bin/circle-dependencies-post no_output_timeout: 360s
# Generate code coverage reports
test: - run: bin/circle-test-teardown
pre: # Destroy testing VMs:
- "$SRCDIR/bin/circle-test-pre": - run:
parallel: true command: bin/circle-destroy-vms
background: true background: true
override: # run goveralls; copy coverage reports to artifacts dir
- "$SRCDIR/bin/circle-test-unit": - deploy:
parallel: true command: $SRCDIR/bin/circle-teardown-pre
- "$SRCDIR/bin/circle-test-smoke": - store_artifacts:
parallel: true path: /tmp/artifacts
timeout: 360 - deploy:
post: command: |
- "$SRCDIR/bin/circle-test-teardown": if [ "${CIRCLE_BRANCH}" == "master" ]; then
parallel: true bin/circle-deploy-master
fi
teardown:
pre:
# Destroy testing VMs:
- "cd $SRCDIR/test && ./run-integration-tests.sh destroy":
parallel: true
background: true
- "$SRCDIR/bin/circle-teardown-pre":
parallel: true
deployment:
master:
branch: master
owner: weaveworks
commands:
- "$SRCDIR/bin/circle-deploy-master"
+7
View File
@@ -0,0 +1,7 @@
#!/bin/bash
set -e
source "$SRCDIR/bin/circle-env"
cd "$SRCDIR/test"
./run-integration-tests.sh destroy
+12
View File
@@ -0,0 +1,12 @@
# Set environment variables here because CircleCI can't expand $FOO in 'env' section
export PATH="$PATH:$HOME/.local/bin:/opt/google-cloud-sdk/bin"
export CLOUDSDK_CORE_DISABLE_PROMPTS=1
# Base name of VMs for integration tests:
export NAME=test-$CIRCLE_BUILD_NUM-$CIRCLE_NODE_INDEX
export TEST_VMS_SETUP_OUTPUT_FILE=$CIRCLE_ARTIFACTS/test_vms_setup_output.txt
export TEST_VMS_PROV_AND_CONF_LOCK_FILE=$CIRCLE_ARTIFACTS/test_vms_provisioned_and_configured.txt
export TEST_VMS_READY_LOCK_FILE=$CIRCLE_ARTIFACTS/test_vms_ready.txt
# Google Cloud Platorm images for integration tests:
export USE_IMAGE=1
export DISK_NAME_PREFIX=test-$CIRCLE_BUILD_NUM-0
+2
View File
@@ -16,6 +16,8 @@ source "$(dirname "$0")/wait_for.sh"
exit 1 exit 1
} }
source "$SRCDIR/bin/circle-env"
# Provisioning from image typically take 90 seconds, # Provisioning from image typically take 90 seconds,
# but if we are creating a GCP image, it can take more than 10 minutes: # but if we are creating a GCP image, it can take more than 10 minutes:
wait_for 900 "$TEST_VMS_PROV_AND_CONF_LOCK_FILE" wait_for 900 "$TEST_VMS_PROV_AND_CONF_LOCK_FILE"
+2
View File
@@ -9,6 +9,8 @@ source "$(dirname "$0")/wait_for.sh"
exit 1 exit 1
} }
source "$SRCDIR/bin/circle-env"
# Provisioning from image typically take 90 seconds, # Provisioning from image typically take 90 seconds,
# but if we are creating a GCP image, it can take more than 10 minutes: # but if we are creating a GCP image, it can take more than 10 minutes:
wait_for 900 "$TEST_VMS_READY_LOCK_FILE" wait_for 900 "$TEST_VMS_READY_LOCK_FILE"
+2 -1
View File
@@ -18,7 +18,6 @@ function install_ansible() {
sudo apt-get install -qq -y python-pip python-dev libffi-dev libssl-dev \ sudo apt-get install -qq -y python-pip python-dev libffi-dev libssl-dev \
&& pip install --user -U setuptools cffi \ && pip install --user -U setuptools cffi \
&& pip install --user ansible && pip install --user ansible
export PATH="$PATH:$HOME/.local/bin"
} }
[ -n "$SECRET_KEY" ] || { [ -n "$SECRET_KEY" ] || {
@@ -26,6 +25,8 @@ function install_ansible() {
exit 1 exit 1
} }
source "$SRCDIR/bin/circle-env"
install_terraform >>"$TEST_VMS_SETUP_OUTPUT_FILE" 2>&1 install_terraform >>"$TEST_VMS_SETUP_OUTPUT_FILE" 2>&1
install_ansible >>"$TEST_VMS_SETUP_OUTPUT_FILE" 2>&1 install_ansible >>"$TEST_VMS_SETUP_OUTPUT_FILE" 2>&1