This repository has been archived by the owner on Jun 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 673
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2694 from weaveworks/2647-testing-mvp
Testing MVP Fixes #2647
- Loading branch information
Showing
26 changed files
with
726 additions
and
543 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,3 +68,5 @@ test/tls/*.pem | |
test/coverage | ||
test/coverage.* | ||
*qemu-*-static | ||
terraform.tfstate | ||
terraform.tfstate.backup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,27 @@ | ||
# IMPORTANT: Please only use GLOBs to ignore files and directories. | ||
|
||
# Do not lint any bash script in Weave Net, in order to | ||
# Do not lint the below bash scripts in Weave Net, in order to | ||
# avoid breaking the build on make lint: | ||
*.sh | ||
bin/* | ||
bin/circle-deploy-issues | ||
bin/circle-deploy-master | ||
bin/circle-teardown-pre | ||
bin/circle-test-teardown | ||
bin/circle-test-unit | ||
bin/install-wordepress | ||
bin/multiweave | ||
bin/publish-site | ||
bin/release | ||
build/build.sh | ||
prog/weave-kube/launch.sh | ||
prog/weaveexec/symlink | ||
test/*_test.sh | ||
test/600_proxy_docker_py.sh | ||
test/assert.sh | ||
test/config.sh | ||
test/gce.sh | ||
test/gen_coverage_reports.sh | ||
test/run_all.sh | ||
test/sanity_check.sh | ||
test/setup.sh | ||
vendor/*.sh | ||
weave |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Signal failures in lock file, in order to fail fast: | ||
function signal_failure() { | ||
echo "KO" >"$TEST_VMS_PROV_AND_CONF_LOCK_FILE" | ||
exit 1 | ||
} | ||
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 | ||
} | ||
|
||
function install_ansible() { | ||
sudo apt-get update || true | ||
sudo apt-get install -qq -y python-pip python-dev libffi-dev libssl-dev && pip install --user -U cffi && pip install --user 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 | ||
} | ||
|
||
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 | ||
|
||
# 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 |
Oops, something went wrong.