From d2c29f086d4191218b8b8a3af3bad271ef94eca0 Mon Sep 17 00:00:00 2001 From: zhzhuang-zju Date: Fri, 11 Oct 2024 15:34:24 +0800 Subject: [PATCH] image-scanning: fix ratelimiting error when downloading vulnerability db from ghcr.io Signed-off-by: zhzhuang-zju --- .github/workflows/ci-image-scanning-on-schedule.yml | 5 +++++ .github/workflows/ci-image-scanning.yaml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/.github/workflows/ci-image-scanning-on-schedule.yml b/.github/workflows/ci-image-scanning-on-schedule.yml index 948e8389b..02942d047 100644 --- a/.github/workflows/ci-image-scanning-on-schedule.yml +++ b/.github/workflows/ci-image-scanning-on-schedule.yml @@ -48,6 +48,9 @@ jobs: make image-${{ matrix.target }} - name: Run Trivy vulnerability scanner uses: aquasecurity/trivy-action@0.28.0 + env: + ACTIONS_RUNTIME_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TRIVY_DB_REPOSITORY: ghcr.io/aquasecurity/trivy-db,public.ecr.aws/aquasecurity/trivy-db with: image-ref: 'docker.io/karmada/${{ matrix.target }}:${{ matrix.karmada-version }}' format: 'sarif' @@ -56,6 +59,8 @@ jobs: output: '${{ matrix.target }}:${{ matrix.karmada-version }}.trivy-results.sarif' - name: display scan results uses: aquasecurity/trivy-action@0.28.0 + env: + TRIVY_SKIP_DB_UPDATE: true # Avoid updating the vulnerability db as it was cached in the previous step. with: image-ref: 'docker.io/karmada/${{ matrix.target }}:${{ matrix.karmada-version }}' format: 'table' diff --git a/.github/workflows/ci-image-scanning.yaml b/.github/workflows/ci-image-scanning.yaml index 72c898e50..4e5d3a07b 100644 --- a/.github/workflows/ci-image-scanning.yaml +++ b/.github/workflows/ci-image-scanning.yaml @@ -43,6 +43,9 @@ jobs: make image-${{ matrix.target }} - name: Run Trivy vulnerability scanner uses: aquasecurity/trivy-action@0.28.0 + env: + ACTIONS_RUNTIME_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TRIVY_DB_REPOSITORY: ghcr.io/aquasecurity/trivy-db,public.ecr.aws/aquasecurity/trivy-db with: image-ref: 'docker.io/karmada/${{ matrix.target }}:latest' format: 'sarif' @@ -51,6 +54,8 @@ jobs: output: 'trivy-results.sarif' - name: display scan results uses: aquasecurity/trivy-action@0.28.0 + env: + TRIVY_SKIP_DB_UPDATE: true # Avoid updating the vulnerability db as it was cached in the previous step. with: image-ref: 'docker.io/karmada/${{ matrix.target }}:latest' format: 'table'