Skip to content

Commit

Permalink
Preload Trivy DB
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
WyriHaximus committed Nov 15, 2024
1 parent 880fc9d commit b1f67b8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ jobs:
image: ${{ steps.image-matrix.outputs.image }}
steps:
- uses: actions/checkout@v4
- name: Preload Trivy DB
uses: nick-invision/retry@v3
with:
timeout_minutes: 120
retry_wait_seconds: 1
max_attempts: 13
command: docker pull "ghcr.io/aquasecurity/trivy-db:2"
- id: image-matrix
name: Generate Combined Image Matrix
run: |
Expand Down Expand Up @@ -176,6 +183,13 @@ jobs:
image: ${{ fromJson(needs.image-matrix.outputs.image) }}
exclude: ${{ fromJson(needs.exclude-matrix.outputs.exclude) }}
steps:
- name: Preload Trivy DB
uses: nick-invision/retry@v3
with:
timeout_minutes: 120
retry_wait_seconds: 1
max_attempts: 13
command: docker pull "ghcr.io/aquasecurity/trivy-db:2"
- uses: actions/checkout@v4
if: contains(matrix.image, 'alpine')
- uses: dbhi/qus/action@main
Expand Down
2 changes: 1 addition & 1 deletion test-nts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ docker run --rm -t \
renatomefi/docker-testinfra:5 \
-m "$TEST_SUITE" --junitxml="/results/php-nts-$DOCKER_TAG.xml" \
--disable-pytest-warnings \
--verbose --hosts="docker://$DOCKER_CONTAINER"
--verbose --hosts="docker://$DOCKER_CONTAINER"
2 changes: 1 addition & 1 deletion test-zts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ docker run --rm -t \
renatomefi/docker-testinfra:5 \
-m "$TEST_SUITE" --junitxml="/results/php-zts-$DOCKER_TAG.xml" \
--disable-pytest-warnings \
--verbose --hosts="docker://$DOCKER_CONTAINER"
--verbose --hosts="docker://$DOCKER_CONTAINER"

0 comments on commit b1f67b8

Please sign in to comment.