Skip to content

Commit b1f67b8

Browse files
committed
Preload Trivy DB
GitHub's container registry has implemented some rate limiting, this will try to load the database 13 times before running Trivy. For the past few weeks almost every single image build failed due to this and it takes a dozen retries easily to get all scans to pass.
1 parent 880fc9d commit b1f67b8

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ jobs:
7575
image: ${{ steps.image-matrix.outputs.image }}
7676
steps:
7777
- uses: actions/checkout@v4
78+
- name: Preload Trivy DB
79+
uses: nick-invision/retry@v3
80+
with:
81+
timeout_minutes: 120
82+
retry_wait_seconds: 1
83+
max_attempts: 13
84+
command: docker pull "ghcr.io/aquasecurity/trivy-db:2"
7885
- id: image-matrix
7986
name: Generate Combined Image Matrix
8087
run: |
@@ -176,6 +183,13 @@ jobs:
176183
image: ${{ fromJson(needs.image-matrix.outputs.image) }}
177184
exclude: ${{ fromJson(needs.exclude-matrix.outputs.exclude) }}
178185
steps:
186+
- name: Preload Trivy DB
187+
uses: nick-invision/retry@v3
188+
with:
189+
timeout_minutes: 120
190+
retry_wait_seconds: 1
191+
max_attempts: 13
192+
command: docker pull "ghcr.io/aquasecurity/trivy-db:2"
179193
- uses: actions/checkout@v4
180194
if: contains(matrix.image, 'alpine')
181195
- uses: dbhi/qus/action@main

test-nts.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ docker run --rm -t \
5858
renatomefi/docker-testinfra:5 \
5959
-m "$TEST_SUITE" --junitxml="/results/php-nts-$DOCKER_TAG.xml" \
6060
--disable-pytest-warnings \
61-
--verbose --hosts="docker://$DOCKER_CONTAINER"
61+
--verbose --hosts="docker://$DOCKER_CONTAINER"

test-zts.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ docker run --rm -t \
5858
renatomefi/docker-testinfra:5 \
5959
-m "$TEST_SUITE" --junitxml="/results/php-zts-$DOCKER_TAG.xml" \
6060
--disable-pytest-warnings \
61-
--verbose --hosts="docker://$DOCKER_CONTAINER"
61+
--verbose --hosts="docker://$DOCKER_CONTAINER"

0 commit comments

Comments
 (0)