ci: cypress on documentDB init db from backup archive (#26710)

Restoring db of each run from a mongo archive with initial migrations
already applied to speed up the tests.
This commit is contained in:
Sumesh Pradhan 2023-08-28 18:06:07 +05:30 committed by GitHub
parent 968eb9950b
commit adedf0c159
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -125,6 +125,19 @@ jobs:
- name: cat run_result
run: echo ${{ steps.run_result.outputs.run_result }}
- name: Install mongosh
run: |
sudo apt-get update
sudo apt-get install -y wget gnupg
wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
sudo apt-get update
sudo apt-get install -y mongodb-mongosh
- name: Download mongodb archive
run: |
curl -o data.gz https://appsmithctl-backup-restore-test.s3.ap-south-1.amazonaws.com/docdb-data.gz
- name: Download Docker image artifact
uses: actions/download-artifact@v3
@ -154,6 +167,7 @@ jobs:
chmod 400 ssh_key.pem
ssh -4 -o StrictHostKeyChecking=no -o ServerAliveInterval=180 -o ServerAliveCountMax=5 -i "ssh_key.pem" -L 0.0.0.0:27010:docdb-ansible-test-cluster.cluster-cz8diybf9wdj.ap-south-1.docdb.amazonaws.com:27017 ubuntu@65.1.106.35 -N -f
- name: Run Appsmith, CS & TED docker image
if: steps.run_result.outputs.run_result != 'success'
working-directory: "."
@ -165,6 +179,7 @@ jobs:
hash=$(echo -n "$timestamp" | sha1sum | awk '{print $1}')
current_date=$(date -d "@$timestamp" +"%d-%m")
DB_NAME="ci${hash:1:3}-${current_date}"
mongorestore --uri="${APPSMITH_MONGODB_URI}${DB_NAME}?retryWrites=false&replicaSet=rs0&directConnection=true" --archive=data.gz --gzip --drop --nsInclude=*
sudo /etc/init.d/ssh stop ;
mkdir -p ~/git-server/keys
mkdir -p ~/git-server/repos