diff --git a/bin/circle-dependencies-post b/bin/circle-dependencies-post index 1b705fc6..e196ca3f 100755 --- a/bin/circle-dependencies-post +++ b/bin/circle-dependencies-post @@ -2,16 +2,12 @@ set -e -source "$STATE" - -if [ -n "$TEST_AND_PUBLISH" ]; then - cd "$SRCDIR" - git submodule update --init - cd "$SRCDIR/build" - ../tools/rebuild-image weaveworks/weavebuild . Dockerfile build.sh - touch "$SRCDIR/.build.uptodate" - sudo chown -R ubuntu /usr/local/go - cd "$SRCDIR" - make testrunner - make COVERAGE=true RM= exes all -fi +cd "$SRCDIR" +git submodule update --init +cd "$SRCDIR/build" +../tools/rebuild-image weaveworks/weavebuild . Dockerfile build.sh +touch "$SRCDIR/.build.uptodate" +sudo chown -R ubuntu /usr/local/go +cd "$SRCDIR" +make testrunner +make COVERAGE=true RM= exes all diff --git a/bin/circle-dependencies-post-sources b/bin/circle-dependencies-post-sources index f6875ced..8723f116 100755 --- a/bin/circle-dependencies-post-sources +++ b/bin/circle-dependencies-post-sources @@ -2,35 +2,6 @@ set -e -echo "TEST_AND_PUBLISH=1" >"$STATE" - -# Avoid doing a full build if we can. Note if the PR doesn't exist -# when the build is kicked off, we can't run this check so we do a -# full build. Subsequent pushes to the same branch will have the desired behaviour -if [ -n "$CI_PULL_REQUEST" -a "$CI_PULL_REQUEST" = "$CI_PULL_REQUESTS" ]; then - if PR=$(echo "$CI_PULL_REQUEST" | grep -oP '(?<=^https://github.com/weaveworks/weave/pull/)[0-9]+$'); then - echo "GH_PR=$PR" >>"$STATE" - if FILES=$(curl -s "https://api.github.com/repos/weaveworks/weave/pulls/$PR/files" | jq -r '.[]|.filename'); then - echo "PR touches [$FILES]" - if ! echo "$FILES" | grep -v ^site/; then - echo "PR contains site changes only - skipping tests" - echo "TEST_AND_PUBLISH=" >>"$STATE" - else - echo "PR contains non-site changes - running tests" - fi - else - echo "Unable to get files for PR $PR" >&2 - fi - else - echo "Unable to extract PR number from $CI_PULL_REQUEST" >&2 - fi -fi - -source "$STATE" - mkdir -p "$(dirname "$SRCDIR")" && cp -r "$(pwd)/" "$SRCDIR" - -if [ -n "$TEST_AND_PUBLISH" ]; then - cd "$SRCDIR" - git submodule update --init -fi +cd "$SRCDIR" +git submodule update --init diff --git a/bin/circle-deploy-master b/bin/circle-deploy-master index 4c0efb56..b969bde3 100755 --- a/bin/circle-deploy-master +++ b/bin/circle-deploy-master @@ -2,12 +2,8 @@ set -e -source "$STATE" - -if [ -n "$TEST_AND_PUBLISH" ] ; then - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS - cd $SRCDIR - make clean-bin - # CircleCI doesn't let us install the qemu module to do ARM docker builds - make publish ALL_ARCHITECTURES=amd64 UPDATE_LATEST=latest-only -fi +docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS +cd $SRCDIR +make clean-bin +# CircleCI doesn't let us install the qemu module to do ARM docker builds +make publish ALL_ARCHITECTURES=amd64 UPDATE_LATEST=latest-only diff --git a/bin/circle-teardown-pre b/bin/circle-teardown-pre index d11b1111..d4ac8e3c 100755 --- a/bin/circle-teardown-pre +++ b/bin/circle-teardown-pre @@ -2,12 +2,8 @@ set -e -source "$STATE" - -if [ -n "$TEST_AND_PUBLISH" ] ; then - if [ "$CIRCLE_NODE_INDEX" = "0" ] ; then - go get github.com/mattn/goveralls - goveralls -repotoken $COVERALLS_REPO_TOKEN -coverprofile=$SRCDIR/test/profile.cov -service=circleci - cd $SRCDIR/test; cp coverage.* $CIRCLE_ARTIFACTS - fi +if [ "$CIRCLE_NODE_INDEX" = "0" ] ; then + go get github.com/mattn/goveralls + goveralls -repotoken $COVERALLS_REPO_TOKEN -coverprofile=$SRCDIR/test/profile.cov -service=circleci + cd $SRCDIR/test; cp coverage.* $CIRCLE_ARTIFACTS fi diff --git a/bin/circle-test-pre b/bin/circle-test-pre index 67254cf9..1fa0dc49 100755 --- a/bin/circle-test-pre +++ b/bin/circle-test-pre @@ -9,22 +9,19 @@ function signal_failure() { } trap signal_failure ERR -source "$STATE" source "$(dirname "$0")/wait_for.sh" -if [ -n "$TEST_AND_PUBLISH" ]; then - [ -n "$SECRET_KEY" ] || { - echo "Cannot run smoke tests: no secret key" - exit 1 - } +[ -n "$SECRET_KEY" ] || { + echo "Cannot run smoke tests: no secret key" + exit 1 +} - # Provisioning from image typically take 90 seconds, - # 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" +# Provisioning from image typically take 90 seconds, +# 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" - # Upload built binaries to testing VMs: - cd "$SRCDIR/test" # Ensures we generate Terraform state files in the right folder, for later use by integration tests. - ./run-integration-tests.sh setup >>"$TEST_VMS_SETUP_OUTPUT_FILE" 2>&1 - echo "OK" >"$TEST_VMS_READY_LOCK_FILE" - echo "Test VMs now ready. $(date)." >>"$TEST_VMS_SETUP_OUTPUT_FILE" -fi +# Upload built binaries to testing VMs: +cd "$SRCDIR/test" # Ensures we generate Terraform state files in the right folder, for later use by integration tests. +./run-integration-tests.sh setup >>"$TEST_VMS_SETUP_OUTPUT_FILE" 2>&1 +echo "OK" >"$TEST_VMS_READY_LOCK_FILE" +echo "Test VMs now ready. $(date)." >>"$TEST_VMS_SETUP_OUTPUT_FILE" diff --git a/bin/circle-test-smoke b/bin/circle-test-smoke index 250841eb..8f2cf5f3 100755 --- a/bin/circle-test-smoke +++ b/bin/circle-test-smoke @@ -2,22 +2,19 @@ set -e -source "$STATE" source "$(dirname "$0")/wait_for.sh" -if [ -n "$TEST_AND_PUBLISH" ]; then - [ -n "$SECRET_KEY" ] || { - echo "Cannot run smoke tests: no secret key" - exit 1 - } +[ -n "$SECRET_KEY" ] || { + echo "Cannot run smoke tests: no secret key" + exit 1 +} - # Provisioning from image typically take 90 seconds, - # but if we are creating a GCP image, it can take more than 10 minutes: - wait_for 900 "$TEST_VMS_READY_LOCK_FILE" +# Provisioning from image typically take 90 seconds, +# but if we are creating a GCP image, it can take more than 10 minutes: +wait_for 900 "$TEST_VMS_READY_LOCK_FILE" - # Run integration tests: - export COVERAGE=true - export WEAVE_NET_SANITY_CHECKS_FILES="$CIRCLE_ARTIFACTS/weave_net_sanity_check_*.log" - cd "$SRCDIR/test" # Ensures we generate code coverage files in the right folder, and use the Terraform state of previously provisionned VMs. - ./run-integration-tests.sh test -fi +# Run integration tests: +export COVERAGE=true +export WEAVE_NET_SANITY_CHECKS_FILES="$CIRCLE_ARTIFACTS/weave_net_sanity_check_*.log" +cd "$SRCDIR/test" # Ensures we generate code coverage files in the right folder, and use the Terraform state of previously provisionned VMs. +./run-integration-tests.sh test diff --git a/bin/circle-test-teardown b/bin/circle-test-teardown index c2e6ae25..d998a3c7 100755 --- a/bin/circle-test-teardown +++ b/bin/circle-test-teardown @@ -2,9 +2,5 @@ set -e -source "$STATE" - -if [ -n "$TEST_AND_PUBLISH" ] ; then - cd $SRCDIR/test - test "$CIRCLE_NODE_INDEX" != "0" || (cd $SRCDIR/test; ./gen_coverage_reports.sh) -fi +cd $SRCDIR/test +test "$CIRCLE_NODE_INDEX" != "0" || (cd $SRCDIR/test; ./gen_coverage_reports.sh) diff --git a/bin/circle-test-unit b/bin/circle-test-unit index b9ac9a5d..f6a0433b 100755 --- a/bin/circle-test-unit +++ b/bin/circle-test-unit @@ -2,10 +2,6 @@ set -e -source "$STATE" - -if [ -n "$TEST_AND_PUBLISH" ] ; then - cd $SRCDIR - make DEBUG=1 lint - COVERDIR=test/coverage make RM= tests -fi +cd $SRCDIR +make DEBUG=1 lint +COVERDIR=test/coverage make RM= tests diff --git a/bin/provision_test_vms.sh b/bin/provision_test_vms.sh index b5641cf6..70978f14 100755 --- a/bin/provision_test_vms.sh +++ b/bin/provision_test_vms.sh @@ -9,8 +9,6 @@ function signal_failure() { } trap signal_failure ERR -source "$STATE" - function install_terraform() { curl -fsS https://releases.hashicorp.com/terraform/0.8.5/terraform_0.8.5_linux_amd64.zip | gunzip >terraform && chmod +x terraform && sudo mv terraform /usr/bin } @@ -23,21 +21,19 @@ function install_ansible() { export PATH="$PATH:$HOME/.local/bin" } -if [ -n "$TEST_AND_PUBLISH" ]; then - [ -n "$SECRET_KEY" ] || { - echo "Cannot run smoke tests: no secret key" - exit 1 - } +[ -n "$SECRET_KEY" ] || { + echo "Cannot run smoke tests: no secret key" + exit 1 +} - install_terraform >>"$TEST_VMS_SETUP_OUTPUT_FILE" 2>&1 - install_ansible >>"$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 - # Only attempt to create GCP image in first container, wait for it to be created otherwise: - [ "$CIRCLE_NODE_INDEX" != "0" ] && export CREATE_IMAGE=0 +# Only attempt to create GCP image in first container, wait for it to be created otherwise: +[ "$CIRCLE_NODE_INDEX" != "0" ] && export CREATE_IMAGE=0 - # Provision and configure testing VMs: - cd "$SRCDIR/test" # Ensures we generate Terraform state files in the right folder, for later use by integration tests. - ./run-integration-tests.sh configure >>"$TEST_VMS_SETUP_OUTPUT_FILE" 2>&1 - echo "OK" >"$TEST_VMS_PROV_AND_CONF_LOCK_FILE" - echo "Test VMs now provisioned and configured. $(date)." >>"$TEST_VMS_SETUP_OUTPUT_FILE" -fi +# Provision and configure testing VMs: +cd "$SRCDIR/test" # Ensures we generate Terraform state files in the right folder, for later use by integration tests. +./run-integration-tests.sh configure >>"$TEST_VMS_SETUP_OUTPUT_FILE" 2>&1 +echo "OK" >"$TEST_VMS_PROV_AND_CONF_LOCK_FILE" +echo "Test VMs now provisioned and configured. $(date)." >>"$TEST_VMS_SETUP_OUTPUT_FILE"