Skip to content

Commit 348c150

Browse files
committed
move trivy scan to separate workflow
1 parent 6bffdf7 commit 348c150

File tree

1 file changed

+11
-49
lines changed

1 file changed

+11
-49
lines changed

.github/workflows/fatimage.yml

Lines changed: 11 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ jobs:
3030
exclude:
3131
- os_version: RL8
3232
build: openstack.openhpc-cuda
33-
3433
env:
3534
ANSIBLE_FORCE_COLOR: True
3635
OS_CLOUD: openstack
3736
CI_CLOUD: ${{ github.event.inputs.ci_cloud }}
37+
BUILD: "${{ matrix.build }}-${{ matrix.os_version }}"
38+
3839
steps:
3940
- uses: actions/checkout@v2
4041

@@ -101,53 +102,14 @@ jobs:
101102
sleep 5
102103
done
103104
IMAGE_NAME=$(openstack image show -f value -c name $IMAGE_ID)
104-
echo "image-name=${IMAGE_NAME}" >> "$GITHUB_OUTPUT"
105-
echo "image-id=$IMAGE_ID" >> "$GITHUB_OUTPUT"
106-
107-
- name: Download image
108-
run: |
109-
. venv/bin/activate
110-
sudo mkdir /mnt/images
111-
sudo chmod 777 /mnt/images
112-
openstack image save --file /mnt/images/${{ steps.manifest.outputs.image-name }}.qcow2 ${{ steps.manifest.outputs.image-name }}
113-
114-
- name: Set up QEMU
115-
uses: docker/setup-qemu-action@v3
116-
117-
- name: install libguestfs
118-
run: |
119-
sudo apt -y update
120-
sudo apt -y install libguestfs-tools
121-
122-
- name: mkdir for mount
123-
run: sudo mkdir -p './${{ steps.manifest.outputs.image-name }}'
124-
125-
- name: mount qcow2 file
126-
run: sudo guestmount -a /mnt/images/${{ steps.manifest.outputs.image-name }}.qcow2 -i --ro -o allow_other './${{ steps.manifest.outputs.image-name }}'
127-
128-
- name: Run Trivy vulnerability scanner
129-
uses: aquasecurity/[email protected]
130-
with:
131-
scan-type: fs
132-
scan-ref: "${{ steps.manifest.outputs.image-name }}"
133-
scanners: "vuln"
134-
format: sarif
135-
output: "${{ steps.manifest.outputs.image-name }}.sarif"
136-
# turn off secret scanning to speed things up
137-
138-
- name: Upload Trivy scan results to GitHub Security tab
139-
uses: github/codeql-action/upload-sarif@v3
140-
with:
141-
sarif_file: "${{ steps.manifest.outputs.image-name }}.sarif"
142-
category: "${{ matrix.os_version }}-${{ matrix.build }}"
105+
echo $IMAGE_ID > image-id-${{ env.BUILD }}.txt
106+
echo $IMAGE_NAME > image-name-${{ env.BUILD }}.txt
143107
144-
- name: Fail if scan has CRITICAL vulnerabilities
145-
uses: aquasecurity/[email protected]
108+
- name: Upload manifest artifact
109+
uses: actions/upload-artifact@v4
146110
with:
147-
scan-type: fs
148-
scan-ref: "${{ steps.manifest.outputs.image-name }}"
149-
scanners: "vuln"
150-
format: table
151-
exit-code: '1'
152-
severity: 'CRITICAL'
153-
ignore-unfixed: true
111+
name: image-details
112+
path: |
113+
./image-id-${{ env.BUILD }}.txt
114+
./image-name-${{ env.BUILD }}.txt
115+
overwrite: true

0 commit comments

Comments
 (0)