Skip to content

Commit

Permalink
Improve and document script
Browse files Browse the repository at this point in the history
  • Loading branch information
fwilhe committed Dec 16, 2024
1 parent 4b1e554 commit 9034fb9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ Utility to add CVE context information to GLVD.

Data is maintained [here](https://github.com/gardenlinux/glvd-triage-data) in yaml files.

Example usage:
## usage:

```
kubectl run glvd-triage-$(date +%s) --image=ghcr.io/gardenlinux/triage:latest --restart=Never --env=PGHOST=glvd-database-0.glvd-database --env=PGPASSWORD=$(kubectl get secret/postgres-credentials --template="{{.data.password}}" | base64 -d) --env=GLVD_TRIAGE_FILE=sample.yaml --env=PAT=YOUR_PAT
Download the [glvd-triage.sh script](https://raw.githubusercontent.com/gardenlinux/glvd-triage-cli/refs/heads/main/glvd-triage.sh), for example like this:

```bash
mkdir -p ~/bin
wget --output-document ~/bin/glvd-triage https://raw.githubusercontent.com/gardenlinux/glvd-triage-cli/refs/heads/main/glvd-triage.sh
chmod +x ~/bin/glvd-triage
```
17 changes: 13 additions & 4 deletions glvd-triage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@
set -o nounset
set -o errexit

# Script to apply new triage data to the glvd database
# This script requires access to the `glvd` gardener cluster via kubectl

SCRIPT_NAME="${0##*/}"
readonly SCRIPT_NAME

usage() {
echo "Script to apply new triage data to the glvd database"
echo ""
echo "Requirements:"
echo " - This script requires access to the 'glvd' gardener cluster via kubectl"
echo " Be sure to set the KUBECONFIG environment variable accordingly."
echo " - This script requires a github personal access token with read access to https://github.com/gardenlinux/glvd-triage-data"
echo ""
echo "Usage: $SCRIPT_NAME my-triage-file.yaml my-github-pat"
echo ""
exit 1
}

Expand All @@ -20,6 +25,10 @@ main() {
local triage_file="${1}"; shift
local github_pat="${1}"; shift

echo "Test if glvd-database-0 exists"
echo "We need this, be sure you have the correct kubeconfig set"
kubectl get pods glvd-database-0 || usage

local now
now="$(date +%s)"

Expand All @@ -32,5 +41,5 @@ main() {
--env=PAT="$github_pat"
}

[[ $# -ge 2 ]] || usage
main "${@}"

0 comments on commit 9034fb9

Please sign in to comment.