Skip to content

Commit 5b8593f

Browse files
Revert SBOM action (#23)
* Revert sbom-action to 0.13.4 * Enhace sbom action to test on multi arch image
1 parent e23ffea commit 5b8593f

File tree

3 files changed

+43
-6
lines changed

3 files changed

+43
-6
lines changed

.github/workflows/docker-image-scan.yml

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,53 @@ jobs:
1212
test-scan-docker-image:
1313
name: Test Scan Docker Image
1414
runs-on: ubuntu-22.04
15+
env:
16+
IMAGE: kong/kong-gateway-dev:latest #particular reason for the choice of image: test multi arch image sbom
1517
steps:
1618
- uses: actions/checkout@v3
1719

20+
- name: Install regctl
21+
uses: regclient/actions/regctl-installer@main
22+
1823
- name: Login to DockerHub
1924
if: success()
2025
uses: docker/login-action@v2
2126
with:
2227
username: ${{ secrets.GHA_DOCKERHUB_PULL_USER }}
2328
password: ${{ secrets.GHA_KONG_ORG_DOCKERHUB_PUBLIC_TOKEN }}
2429

25-
- uses: ./security-actions/scan-docker-image
30+
- name: Parse Architecture Specific Image Manifest Digests
31+
id: image_manifest_metadata
32+
run: |
33+
manifest_list_exists="$(
34+
if regctl manifest get "${IMAGE}" --format raw-body --require-list -v panic &> /dev/null; then
35+
echo true
36+
else
37+
echo false
38+
fi
39+
)"
40+
echo "manifest_list_exists=$manifest_list_exists"
41+
echo "manifest_list_exists=$manifest_list_exists" >> $GITHUB_OUTPUT
42+
43+
amd64_sha="$(regctl image digest "${IMAGE}" --platform linux/amd64 || echo '')"
44+
arm64_sha="$(regctl image digest "${IMAGE}" --platform linux/arm64 || echo '')"
45+
echo "amd64_sha=$amd64_sha"
46+
echo "amd64_sha=$amd64_sha" >> $GITHUB_OUTPUT
47+
echo "arm64_sha=$arm64_sha"
48+
echo "arm64_sha=$arm64_sha" >> $GITHUB_OUTPUT
49+
50+
- name: Scan AMD64 Image digest
51+
id: sbom_action_amd64
52+
if: steps.image_manifest_metadata.outputs.amd64_sha != ''
53+
uses: Kong/public-shared-actions/security-actions/scan-docker-image@v1.1.0
54+
with:
55+
asset_prefix: kong-gateway-dev-linux-amd64
56+
image: ${{env.IMAGE}}@${{ steps.image_manifest_metadata.outputs.amd64_sha }}
57+
58+
- name: Scan ARM64 Image digest
59+
if: steps.image_manifest_metadata.outputs.manifest_list_exists == 'true' && steps.image_manifest_metadata.outputs.arm64_sha != ''
60+
id: sbom_action_arm64
61+
uses: Kong/public-shared-actions/security-actions/scan-docker-image@v1.1.0
2662
with:
27-
image: kong/kong-gateway-dev:latest # no particular reason for the choice of image or tag, just an image for tests
63+
asset_prefix: kong-gateway-dev-linux-arm64
64+
image: ${{env.IMAGE}}@${{ steps.image_manifest_metadata.outputs.arm64_sha }}

code-check-actions/rustcheck/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ runs:
8888

8989
# Must upload artifact for output file parameter to have effect
9090
- name: Generate SPDX SBOM Using Syft
91-
uses: anchore/sbom-action@v0.14.2
91+
uses: anchore/sbom-action@v0.13.4
9292
id: sbom_spdx
9393
with:
9494
image: ${{ steps.meta.outputs.scan_image }}
@@ -104,7 +104,7 @@ runs:
104104
dependency-snapshot: false
105105

106106
- name: Generate CycloneDX SBOM Using Syft
107-
uses: anchore/sbom-action@v0.14.2
107+
uses: anchore/sbom-action@v0.13.4
108108
id: sbom_cyclonedx
109109
with:
110110
image: ${{ steps.meta.outputs.scan_image }}

security-actions/scan-docker-image/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ runs:
7171

7272
# Must upload artifact for output file parameter to have effect
7373
- name: Generate SPDX SBOM Using Syft
74-
uses: anchore/sbom-action@v0.14.2
74+
uses: anchore/sbom-action@v0.13.4
7575
id: sbom_spdx
7676
with:
7777
image: ${{ steps.meta.outputs.scan_image }}
@@ -87,7 +87,7 @@ runs:
8787
dependency-snapshot: false
8888

8989
- name: Generate CycloneDX SBOM Using Syft
90-
uses: anchore/sbom-action@v0.14.2
90+
uses: anchore/sbom-action@v0.13.4
9191
id: sbom_cyclonedx
9292
with:
9393
image: ${{ steps.meta.outputs.scan_image }}

0 commit comments

Comments
 (0)