Skip to content

Commit

Permalink
Add data ingestion mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
nanory committed Dec 20, 2023
1 parent cf07f7c commit ad52061
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 6 deletions.
39 changes: 33 additions & 6 deletions .github/workflows/data_ingestion.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,40 @@
name: Data ingestion
on: ["push", "workflow_dispatch"]
jobs:
test:
data_ingestion:
environment: glvd-data-ingestion
name: data ingestion
runs-on: ubuntu-latest
env:
PGHOST: "${{ vars.PGHOST }}"
PGPORT: ${{ vars.PGPORT }}
PGUSER: ${{ vars.PGUSER }}
PGPASSWORD: ${{ secrets.PGPASSWORD }}
PGDATABASE: ${{ vars.PGDATABASE }}
steps:
- run: |
echo "${{ vars.PGDATABASE }}"
echo "${{ vars.PGHOST }}"
echo "${{ vars.PGPORT }}"
echo "${{ vars.PGUSER }}"
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Prepare ingestion data
run: ./src/prepare_ingestion.sh

- name: Run glvd for data ingestion
run: >
docker run
--network host
--rm
--mount="type=bind,src=$PWD/$GITHUB_ACTION_PATH/src,dst=/mnt/src,ro"
--mount="type=bind,src=ingest-debsec/,dst=/mnt/ingest-debsec,ro"
--mount="type=bind,src=ingest-debsrc/,dst=/mnt/ingest-debsrc,ro"
--workdir=/mnt/src
--entrypoint=/bin/bash
--env PGHOST="$PGHOST"
--env PGPORT="$PGPORT"
--env PGUSER="$PGUSER"
--env PGPASSWORD="$PGPASSWORD"
--env PGDATABASE="$PGDATABASE"
ghcr.io/gardenlinux/glvd:edge
data_ingestion.sh
15 changes: 15 additions & 0 deletions src/data_ingestion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# ---------
# Ingest NVD data
#glvd-data ingest-nvd

# ---------
# Ingest CVE lists
glvd-data ingest-debsec debian /mnt/ingest-debsec/debian
glvd-data ingest-debsec debian /mnt/ingest-debsec/gardenlinux

# ---------
# Ingest Debian sources
#glvd-data ingest-debsrc debian trixie /mnt/ingest-debsrc/debian_sources
#glvd-data ingest-debsrc debian trixie /mnt/ingest-debsrc/gardenlinux_sources
15 changes: 15 additions & 0 deletions src/prepare_ingestion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# Preparation
apt update
apt install -y wget

mkdir ingest-debsec/
mkdir ingest-debsrc/

# Data Ingestion: Deb Sec
wget https://salsa.debian.org/security-tracker-team/security-tracker/-/raw/master/data/CVE/list?ref_type=heads -O ingest-debsec/debian
cp -a data/CVE/list ingest-debsec/gardenlinux

# Data Ingestion: Deb Src
#wget http://ftp.debian.org/debian/dists/testing/main/source/

0 comments on commit ad52061

Please sign in to comment.