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
+70 -61

No files matched your search

+45 -60
View File
@@ -1,66 +1,51 @@
general: version: 2
branches: jobs:
ignore: build:
- gh\-pages
machine: machine:
pre: image: circleci/classic:201709-01
- curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | bash -s -- 1.10.0
services:
- docker
environment: environment:
GOPATH: /home/ubuntu:$GOPATH GOPATH: /home/circleci
SRCDIR: /home/ubuntu/src/github.com/weaveworks/weave SRCDIR: /home/circleci/src/github.com/weaveworks/weave
PATH: $PATH:$HOME/.local/bin:/opt/google-cloud-sdk/bin CIRCLE_ARTIFACTS: /tmp/artifacts
CLOUDSDK_CORE_DISABLE_PROMPTS: 1 parallelism: 2
STATE: /home/ubuntu/state.env steps:
# Base name of VMs for integration tests: - checkout
NAME: test-$CIRCLE_BUILD_NUM-$CIRCLE_NODE_INDEX - run: mkdir $CIRCLE_ARTIFACTS
TEST_VMS_SETUP_OUTPUT_FILE: $CIRCLE_ARTIFACTS/test_vms_setup_output.txt # copy source dir and submodule update --init
TEST_VMS_PROV_AND_CONF_LOCK_FILE: $CIRCLE_ARTIFACTS/test_vms_provisioned_and_configured.txt - run: bin/circle-dependencies-post-sources
TEST_VMS_READY_LOCK_FILE: $CIRCLE_ARTIFACTS/test_vms_ready.txt - restore_cache:
# Google Cloud Platorm images for integration tests: key: v1-cache-{{ checksum "build/Dockerfile" }}-{{ checksum "build/build.sh" }}
USE_IMAGE: 1 # kick off creation of test VMs
DISK_NAME_PREFIX: test-$CIRCLE_BUILD_NUM-0 - run:
command: bin/provision_test_vms.sh
dependencies: background: true
cache_directories: # create build image and make all
- run: bin/circle-dependencies-post
- save_cache:
key: v1-cache-{{ checksum "build/Dockerfile" }}-{{ checksum "build/build.sh" }}
paths:
- "~/docker" - "~/docker"
post: # when VMs are ready, copy built software to them
- bin/circle-dependencies-post-sources - run:
# Provision & configure testing VMs: command: bin/circle-test-pre
- "while [ ! -d $SRCDIR ]; do sleep 1; done; $SRCDIR/bin/provision_test_vms.sh":
parallel: true
background: true background: true
- bin/circle-dependencies-post - run: bin/circle-test-unit
- run:
test: command: bin/circle-test-smoke
pre: no_output_timeout: 360s
- "$SRCDIR/bin/circle-test-pre": # Generate code coverage reports
parallel: true - run: bin/circle-test-teardown
background: true
override:
- "$SRCDIR/bin/circle-test-unit":
parallel: true
- "$SRCDIR/bin/circle-test-smoke":
parallel: true
timeout: 360
post:
- "$SRCDIR/bin/circle-test-teardown":
parallel: true
teardown:
pre:
# Destroy testing VMs: # Destroy testing VMs:
- "cd $SRCDIR/test && ./run-integration-tests.sh destroy": - run:
parallel: true command: bin/circle-destroy-vms
background: true background: true
- "$SRCDIR/bin/circle-teardown-pre": # run goveralls; copy coverage reports to artifacts dir
parallel: true - deploy:
command: $SRCDIR/bin/circle-teardown-pre
deployment: - store_artifacts:
master: path: /tmp/artifacts
branch: master - deploy:
owner: weaveworks command: |
commands: if [ "${CIRCLE_BRANCH}" == "master" ]; then
- "$SRCDIR/bin/circle-deploy-master" bin/circle-deploy-master
fi
+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