Skip to content

02 - Dump GLVD Postgres Snapshot to sql file #2

02 - Dump GLVD Postgres Snapshot to sql file

02 - Dump GLVD Postgres Snapshot to sql file #2

name: 02 - Dump GLVD Postgres Snapshot to sql file
on:
workflow_dispatch:
jobs:
dump-db-snapshot:
runs-on: ubuntu-latest
container: ghcr.io/gardenlinux/glvd-data-ingestion:latest
env:
PGUSER: glvd
PGDATABASE: glvd
PGPASSWORD: glvd
PGHOST: postgres
PGPORT: 5432
services:
postgres:
image: ghcr.io/gardenlinux/glvd-postgres:latest
env:
POSTGRES_USER: glvd
POSTGRES_DB: glvd
POSTGRES_PASSWORD: glvd
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: download newer script
run: curl -L https://github.com/gardenlinux/glvd-data-ingestion/raw/refs/heads/apt-source-repo/ingest-postgres.sh > ./ingest-postgres.sh; chmod +x ./ingest-postgres.sh
- name: Ingest Data
run: ./ingest-postgres.sh
- run: |
echo "$PGHOST:$PGPORT:$PGDATABASE:$PGUSER:$PGPASSWORD" > ~/.pgpass
chmod 0600 ~/.pgpass
- run: psql glvd -f extra-schema.sql
# Temporary: Have some dummy context to get rid of too many 'open' CVE
- run: psql glvd -f dummy_cve_context.sql
- name: Dump Database Snapshot
run: |
pg_dump -h postgres -p 5432 -U glvd glvd > glvd.sql
- name: Dump Database Schema
run: |
pg_dump --schema-only -h postgres -p 5432 -U glvd glvd > glvd-schema.sql
- uses: actions/upload-artifact@v4
with:
name: glvd.sql
path: glvd.sql
retention-days: 2
- uses: actions/upload-artifact@v4
with:
name: glvd-schema.sql
path: glvd-schema.sql
retention-days: 2