Skip to content

Commit

Permalink
Merge pull request #493 from sir-gon/develop
Browse files Browse the repository at this point in the history
[CONFIG] [Github Actions] Docker flow, trivy issue workaround.
  • Loading branch information
sir-gon authored Oct 1, 2024
2 parents c1ab61a + 8bf891f commit a97efb0
Showing 1 changed file with 12 additions and 28 deletions.
40 changes: 12 additions & 28 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ jobs:
with:
sarif_file: 'snyk.sarif'
scan:
name: "Trivy (sarif)"
name: "Trivy"
runs-on: ubuntu-latest
needs: build
permissions:
Expand All @@ -178,40 +178,24 @@ jobs:
docker load --input /tmp/${{ env.ARTIFACT_NAME }}_prod.tar
docker image ls -a
- name: Run Trivy vulnerability scanner
- name: Run Trivy vulnerability scanner (cli report)
uses: aquasecurity/[email protected]
with:
image-ref: ${{ env.IMAGE_NAME }}:${{ github.sha }}
format: 'table'
env:
TRIVY_DB_REPOSITORY: ${{ vars.TRIVY_DB_REPOSITORY }}

- name: Run Trivy vulnerability scanner (sarif report)
uses: aquasecurity/[email protected]
with:
image-ref: ${{ env.IMAGE_NAME }}:${{ github.sha }}
format: 'sarif'
output: 'trivy-results.sarif'
env:
TRIVY_DB_REPOSITORY: ${{ vars.TRIVY_DB_REPOSITORY }}

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'
env:
ACTIONS_RUNTIME_TOKEN: ${{ secrets.GITHUB_TOKEN }}

report:
name: "Trivy (report)"
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}_prod
path: /tmp/

- name: Load image
run: |
docker load --input /tmp/${{ env.ARTIFACT_NAME }}_prod.tar
docker image ls -a
- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
with:
image-ref: ${{ env.IMAGE_NAME }}:${{ github.sha }}
format: 'table'
env:
ACTIONS_RUNTIME_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit a97efb0

Please sign in to comment.