Skip to content

Commit c01e251

Browse files
committed
fix: use correct Docker tag format for SBOM and Trivy
Docker tags cannot contain slashes, so metadata-action converts branch names like 'feature/docker-v2' to 'feature-docker-v2'. Use steps.meta.outputs.version which has the correct format.
1 parent 9c31ef7 commit c01e251

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

.github/workflows/docker-build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
contents: read
3434
packages: write
3535
id-token: write
36+
outputs:
37+
image-tag: ${{ steps.meta.outputs.version }}
3638

3739
steps:
3840
- name: Checkout repository
@@ -87,7 +89,7 @@ jobs:
8789
if: github.event_name != 'pull_request'
8890
uses: anchore/sbom-action@v0
8991
with:
90-
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
92+
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
9193
format: spdx-json
9294
output-file: sbom.spdx.json
9395

@@ -110,7 +112,7 @@ jobs:
110112
- name: Run Trivy vulnerability scanner
111113
uses: aquasecurity/trivy-action@master
112114
with:
113-
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
115+
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.build.outputs.image-tag }}
114116
format: 'sarif'
115117
output: 'trivy-results.sarif'
116118

0 commit comments

Comments
 (0)