Skip to content

Commit

Permalink
fix(ci): use registry tokens for image scanning
Browse files Browse the repository at this point in the history
  • Loading branch information
cwrau committed Nov 26, 2024
1 parent c0ca8ca commit fa2ef87
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .github/scripts/scan-for-licenses.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
set -eu
set -o pipefail

declare -A IMAGE_PULL_TOKENS=(
["registry-gitlab.teuto.net"]="${TEUTO_PORTAL_WORKER_PULL_TOKEN}"
)

WHITELIST=(
"AGPL-3.0" # We're not writing software 🤷
"AGPL-3.0-only"
Expand Down Expand Up @@ -85,6 +89,12 @@ function scanLicenses() {
fi
}

trivy image --download-db-only

for registry in "${!IMAGE_PULL_TOKENS[@]}"; do
TRIVY_PASSWORD="${IMAGE_PULL_TOKENS["$registry"]}" trivy registry login --username github-cve-scanning "$registry"
done

if [[ "$#" == 1 && -d "$1" ]]; then
scanLicenses "$1"
else
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/check-licenses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- run: pip install yq
- run: /home/linuxbrew/.linuxbrew/bin/brew install trivy
- run: |
- env:
TEUTO_PORTAL_WORKER_PULL_TOKEN: ${{ secrets.TEUTO_PORTAL_WORKER_PULL_TOKEN }}
run: |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
./.github/scripts/scan-for-licenses.sh ${{ needs.getChangedChart.outputs.chart }}
check-licenses-list:
Expand Down

0 comments on commit fa2ef87

Please sign in to comment.