feat(e2e): migrate off circleci (#4576)

Signed-off-by: Rui Chen <rui@chenrui.dev>
Co-authored-by: Christian Winther <jippignu@gmail.com>
This commit is contained in:
Rui Chen
2024-05-20 12:02:10 -04:00
committed by GitHub
parent 633ca09fce
commit 7e79f56173
6 changed files with 47 additions and 74 deletions

View File

@@ -1,28 +0,0 @@
#!/usr/bin/env bash
# Exit immediately if a command returns a non-zero code
set -e
echo "Preparing to run e2e tests"
if [ ! -f atlantis ]; then
echo "atlantis binary not found. exiting...."
exit 1
fi
cp atlantis ${CIRCLE_WORKING_DIRECTORY}/e2e/
# cd into e2e folder
cd e2e/
# Download terraform
curl -LOk https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip
unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip
chmod +x terraform
cp terraform /home/circleci/go/bin
# Download ngrok to create a tunnel to expose atlantis server
wget https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v2-stable-linux-amd64.zip -O ngrok-stable-linux-amd64.zip
unzip ngrok-stable-linux-amd64.zip
chmod +x ngrok
# Download jq
wget -O jq https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64
chmod +x jq
# Copy github config file - replace with circleci user later
cp .gitconfig ~/.gitconfig

View File

@@ -3,15 +3,10 @@
set -euo pipefail
IFS=$'\n\t'
# download all the tooling needed for e2e tests
CIRCLE_WORKING_DIRECTORY="${CIRCLE_WORKING_DIRECTORY/#\~/$HOME}" # https://discuss.circleci.com/t/circle-working-directory-doesnt-expand/17007/5
${CIRCLE_WORKING_DIRECTORY}/scripts/e2e-deps.sh
cd "${CIRCLE_WORKING_DIRECTORY}/e2e"
# start atlantis server in the background and wait for it to start
./atlantis server \
--gh-user="$GITHUB_USERNAME" \
--gh-token="$GITHUB_PASSWORD" \
--gh-user="$ATLANTISBOT_GITHUB_USERNAME" \
--gh-token="$ATLANTISBOT_GITHUB_TOKEN" \
--data-dir="/tmp" \
--log-level="debug" \
--repo-allowlist="github.com/runatlantis/atlantis-tests" \
@@ -20,14 +15,15 @@ cd "${CIRCLE_WORKING_DIRECTORY}/e2e"
sleep 2
# start ngrok in the background and wait for it to start
./ngrok config add-authtoken $NGROK_AUTH_TOKEN
./ngrok http 4141 > /tmp/ngrok.log &
./ngrok config add-authtoken $NGROK_AUTH_TOKEN > /dev/null 2>&1
./ngrok http 4141 > /tmp/ngrok.log 2>&1 &
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=="https") | .public_url')
# Now we can start the e2e tests
cd "${GITHUB_WORKSPACE:-$(git rev-parse --show-toplevel)}/e2e"
echo "Running 'make build'"
make build