Skip to content

Commit 6b89bf0

Browse files
Add Wiz Scanning Into Build Pipeline
1 parent 60df755 commit 6b89bf0

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/build_docker_image.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,44 @@ jobs:
5555
org.opencontainers.image.description=${{ inputs.description }}
5656
org.opencontainers.image.vendor=Apollo GraphQL
5757
org.opencontainers.image.licenses=MIT
58+
- name: Build and Load Docker Image For Testing
59+
id: build-for-testing
60+
uses: docker/build-push-action@67dc78bbaf388b3265f7e1c880e681f4b90d5f48
61+
with:
62+
context: ${{ inputs.directory }}
63+
file: ${{ inputs.directory }}/Dockerfile
64+
load: true
65+
tags: ${{ inputs.image_name }}:test
66+
platforms: ${{ inputs.platforms }}
67+
- name: Install Wiz CLI
68+
working-directory: ${{ runner.temp }}
69+
run: |
70+
apt-get update
71+
apt-get install gpg
72+
curl -Lo wizcli https://downloads.wiz.io/wizcli/latest/wizcli-linux-amd64
73+
curl -Lo wizcli-sha256 https://downloads.wiz.io/wizcli/latest/wizcli-linux-amd64-sha256
74+
curl -Lo wizcli-sha256.sig https://downloads.wiz.io/wizcli/latest/wizcli-linux-amd64-sha256.sig
75+
curl -Lo wiz_public_key.asc https://downloads.wiz.io/wizcli/public_key.asc
76+
gpg --import wiz_public_key.asc
77+
gpg --verify /tmp/wizcli-sha256.sig /tmp/wizcli-sha256
78+
echo "$(cat /tmp/wizcli-sha256) wizcli" | sha256sum --check
79+
chmod +x wizcli
80+
- name: Authenticate Wiz CLI
81+
working-directory: ${{ runner.temp }}
82+
run: |
83+
./wizcli auth --id ${{ secrets.WIZ_CLIENT_ID }} --secret ${{ secrets.WIZ_CLIENT_SECRET }}
84+
- name: Scan Image
85+
working-directory: ${{ runner.temp }}
86+
run: |
87+
mkdir -p /tmp/workspace/sbom
88+
/tmp/wizcli docker scan \
89+
--image ${{ inputs.image_name }}:test \
90+
--dockerfile ${{ inputs.directory }}/Dockerfile \
91+
--policy "Apollo-Default-Vulnerabilities-Policy" \
92+
--sbom-format spdx-json \
93+
--sbom-output-file ${{ runner.temp }}/${{ inputs.image_name }}/sbom.json \
94+
--timeout "0h9m0s" \
95+
--sensitive-data
5896
- name: Build and Push Docker image
5997
id: push
6098
uses: docker/build-push-action@67dc78bbaf388b3265f7e1c880e681f4b90d5f48

0 commit comments

Comments
 (0)