ci: extract postgres_password from .env in remote machine

This commit is contained in:
Nicolas Meienberger 2023-08-25 22:30:07 +02:00 committed by Nicolas Meienberger
parent 5e8447c15a
commit af5b5afab5
2 changed files with 11 additions and 1 deletions

View file

@ -9,6 +9,7 @@ env:
APPS_REPO_ID: repo-id
INTERNAL_IP: localhost
REDIS_HOST: redis
REDIS_PASSWORD: redis
APPS_REPO_URL: https://repo.github.com/
DOMAIN: localhost
LOCAL_DOMAIN: tipi.lan

View file

@ -21,6 +21,7 @@ jobs:
outputs:
droplet_id: ${{ steps.create-droplet.outputs.droplet_id }}
droplet_ip: ${{ steps.get-droplet-ip.outputs.droplet_ip }}
postgres_password: ${{ steps.get-postgres-password.outputs.postgres_password }}
steps:
- name: Checkout
@ -94,6 +95,12 @@ jobs:
user: root # TODO: use non-root user
key: ${{ secrets.SSH_KEY }}
- name: Get POSTGRES_PASSWORD from .env file
id: get-postgres-password
run: |
postgres_password=$(ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa root@${{ steps.get-droplet-ip.outputs.droplet_ip }} "cat ./runtipi/.env | grep POSTGRES_PASSWORD | cut -d '=' -f2")
echo "postgres_password=$postgres_password" >> $GITHUB_OUTPUT
e2e:
timeout-minutes: 30
runs-on: ubuntu-latest
@ -126,7 +133,9 @@ jobs:
node-version: 18
- name: Create .env.e2e file with Droplet IP
run: echo "SERVER_IP=${{ needs.deploy.outputs.droplet_ip }}" > .env.e2e
run: |
echo "SERVER_IP=${{ needs.deploy.outputs.droplet_ip }}" > .env.e2e
echo "POSTGRES_PASSWORD=${{ needs.deploy.outputs.postgres_password }}" >> .env.e2e
- name: Install dependencies
run: pnpm install