diff --git a/.circleci/config.yml b/.circleci/config.yml index f4c0a73ac..54c9e2180 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,7 +5,7 @@ jobs: docker: - image: circleci/golang:1.10 environment: - TERRAFORM_VERSION: 0.10.8 + TERRAFORM_VERSION: 0.11.4 steps: - checkout - setup_remote_docker: @@ -17,23 +17,8 @@ jobs: name: post coverage to codecov.io command: bash <(curl -s https://codecov.io/bash) - run: make build-service - - run: - name: Install e2e dependencies - command: make end-to-end-deps - - run: - name: Starting atlantis server in the background - command: cd "${CIRCLE_WORKING_DIRECTORY}/e2e" && ./atlantis server --gh-user="$GITHUB_USERNAME" --gh-token="$GITHUB_PASSWORD" --data-dir="/tmp" --log-level="debug" --repo-whitelist="github.com/runatlantis/atlantis-tests" &> /tmp/atlantis-server.log - background: true - - run: sleep 2 - - run: - name: Starting ngrok - command: cd "${CIRCLE_WORKING_DIRECTORY}/e2e" && ./ngrok http 4141 > /tmp/ngrok.log - background: true - - run: sleep 2 - - run: echo "export ATLANTIS_URL=$(curl -s 'http://localhost:4040/api/tunnels' | jq -r '.tunnels[] | select(.proto=="http") | .public_url')" >> $BASH_ENV - - run: - name: Run e2e tests - command: make end-to-end-tests + # We don't run e2e tests on fork PRs because they don't have access to the secret env vars. + - run: if [ -z "${CIRCLE_PR_REPONAME}" ]; then ./scripts/e2e.sh; fi - run: name: Build image command: | diff --git a/scripts/e2e.sh b/scripts/e2e.sh index a97ba99f3..a1d3a44ee 100755 --- a/scripts/e2e.sh +++ b/scripts/e2e.sh @@ -3,20 +3,30 @@ set -euo pipefail IFS=$'\n\t' -cd e2e/ +# download all the tooling needed for e2e tests +${CIRCLE_WORKING_DIRECTORY}/scripts/e2e-deps.sh +cd "${CIRCLE_WORKING_DIRECTORY}/e2e" -# Download dependencies +# start atlantis server in the background and wait for it to start +./atlantis server --gh-user="$GITHUB_USERNAME" --gh-token="$GITHUB_PASSWORD" --data-dir="/tmp" --log-level="debug" --repo-whitelist="github.com/runatlantis/atlantis-tests" &> /tmp/atlantis-server.log & +sleep 2 + +# start ngrok in the background and wait for it to start +./ngrok http 4141 > /tmp/ngrok.log & +sleep 2 + +# find out what URL ngrok has given us +export ATLANTIS_URL=$(curl -s 'http://localhost:4040/api/tunnels' | jq -r '.tunnels[] | select(.proto=="http") | .public_url') + +# Now we can start the e2e tests echo "Running 'make deps'" make deps -# Run tests echo "Running 'make test'" make test -# Build packages to make sure they can be compiled echo "Running 'make build'" make build -# Run e2e tests echo "Running e2e test: 'make run'" make run