Skip to content

Commit

Permalink
🔧 (.github/workflows/trivy.yml): update Docker image names to include…
Browse files Browse the repository at this point in the history
… suffix for better clarity and consistency in naming conventions
  • Loading branch information
Alejandro Alvarez committed Jul 3, 2024
1 parent 19a9d71 commit 148c0d9
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
fail-fast: false
matrix:
image: [
{dockerfile: Dockerfile, name: liquibase/liquibase},
{dockerfile: Dockerfile.alpine, name: liquibase/liquibase},
{dockerfile: Dockerfile, name: liquibase/liquibase, suffix: ""},
{dockerfile: Dockerfile.alpine, name: liquibase/liquibase, suffix: "-alpine"},
]
permissions:
contents: read # for actions/checkout to fetch code
Expand All @@ -37,14 +37,14 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Build ${{ matrix.image.name }} from Dockerfile
- name: Build ${{ matrix.image.name }}${{ matrix.image.suffix }}" from Dockerfile
run: |
docker build -f ${{ matrix.image.dockerfile }} -t ${{ matrix.image.name }}:${{ github.sha }} .
docker build -f ${{ matrix.image.dockerfile }} -t ${{ matrix.image.name }}${{ matrix.image.suffix }}":${{ github.sha }} .
- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
with:
image-ref: '${{ matrix.image.name }}:${{ github.sha }}'
image-ref: '${{ matrix.image.name }}${{ matrix.image.suffix }}":${{ github.sha }}'
vuln-type: 'os,library'
format: 'sarif'
output: 'trivy-results.sarif'
Expand All @@ -62,15 +62,15 @@ jobs:
SLACK_USERNAME: liquibot
SLACK_WEBHOOK: ${{ secrets.NIGHTLY_BUILDS_SLACK_WEBHOOK }}
SLACK_ICON_EMOJI: ":whale:"
SLACK_FOOTER: "${{ github.repository }} - ${{ matrix.image.name }}:${{ github.sha }}"
SLACK_FOOTER: "${{ github.repository }} - ${{ matrix.image.name }}${{ matrix.image.suffix }}:${{ github.sha }}"
SLACK_LINK_NAMES: true

- name: Upload Trivy scan results to GitHub Security tab
if: always()
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'
category: '${{ matrix.image.name }}'
category: '${{ matrix.image.name }}${{ matrix.image.suffix }}'

- name: Generate Security Report
if: always()
Expand All @@ -93,8 +93,8 @@ jobs:
fail-fast: false
matrix:
image: [
{dockerfile: Dockerfile, name: liquibase/liquibase},
{dockerfile: Dockerfile.alpine, name: liquibase/liquibase},
{dockerfile: Dockerfile, name: liquibase/liquibase, suffix: ""},
{dockerfile: Dockerfile.alpine, name: liquibase/liquibase, suffix: "-alpine"},
]
permissions:
contents: read # for actions/checkout to fetch code
Expand All @@ -107,9 +107,9 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Build ${{ matrix.image.name }} from Dockerfile
- name: Build ${{ matrix.image.name }}${{ matrix.image.suffix }} from Dockerfile
run: |
docker build -f ${{ matrix.image.dockerfile }} -t ${{ matrix.image.name }}:${{ github.sha }} .
docker build -f ${{ matrix.image.dockerfile }} -t ${{ matrix.image.name }}${{ matrix.image.suffix }}:${{ github.sha }} .
- uses: docker/login-action@v3
with:
Expand All @@ -120,7 +120,7 @@ jobs:
uses: docker/[email protected]
with:
command: cves
image: '${{ matrix.image.name }}:${{ github.sha }}'
image: '${{ matrix.image.name }}${{ matrix.image.suffix }}:${{ github.sha }}'
github-token: ${{ secrets.GITHUB_TOKEN }}
write-comment: true
sarif-file: 'scout-results.sarif'
Expand All @@ -136,15 +136,15 @@ jobs:
SLACK_USERNAME: liquibot
SLACK_WEBHOOK: ${{ secrets.NIGHTLY_BUILDS_SLACK_WEBHOOK }}
SLACK_ICON_EMOJI: ":whale:"
SLACK_FOOTER: "${{ github.repository }} - ${{ matrix.image.name }}:${{ github.sha }}"
SLACK_FOOTER: "${{ github.repository }} - ${{ matrix.image.name }}${{ matrix.image.suffix }}:${{ github.sha }}"
SLACK_LINK_NAMES: true

- name: Upload Scout scan results to GitHub Security tab
if: always()
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'scout-results.sarif'
category: '${{ matrix.image.name }}'
category: '${{ matrix.image.name }}${{ matrix.image.suffix }}'

- name: Generate Security Report
if: always()
Expand Down

0 comments on commit 148c0d9

Please sign in to comment.