Skip to content

Commit

Permalink
image dispatched from snapshot workflow for trivy image scan (#2542)
Browse files Browse the repository at this point in the history
* use image dispatched from snapshot workflow

* remove unused matrix and refine the image value passed in dispatch
  • Loading branch information
DaMandal0rian authored Feb 22, 2024
1 parent 754c070 commit 1546ea7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/snapshot-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
event-type: trivy-scan-dispatch
client-payload: '{"sha": "${{ github.sha }}"}'
client-payload: '{"image": "ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}:sha-${{ github.sha }}"}'

executables:
strategy:
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/trivy-security-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
- name: Check Docker image availability with retry
run: |
image="ghcr.io/${{ github.repository_owner }}/${{ github.event.client_payload.image }}:${{ github.event.client_payload.sha }}"
image="${{ github.event.client_payload.image }}"
timeout=900 # Timeout in seconds (15 minutes)
interval=300 # Interval between retries in seconds (5 minutes)
retry_limit=5 # Number of retries
Expand All @@ -43,12 +43,6 @@ jobs:
needs: wait-for-image
if: needs.wait-for-image.outputs.image-available == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
image:
- farmer
- node
- bootstrap-node

steps:
- name: Checkout code
Expand All @@ -57,7 +51,7 @@ jobs:
- name: Run Trivy vulnerability scanner on image
uses: aquasecurity/trivy-action@d43c1f16c00cfd3978dde6c07f4bbcf9eb6993ca # @v0.16.1
with:
image-ref: ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}:sha-${{ github.event.client_payload.sha }}
image-ref: ${{ github.event.client_payload.image }}
format: "sarif"
output: "trivy-results.sarif"
exit-code: "1"
Expand Down

0 comments on commit 1546ea7

Please sign in to comment.