Skip to content

Commit 89996a6

Browse files
committed
Use separate upload job for artifact deps
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
1 parent db48d12 commit 89996a6

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/trivy_images.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,12 @@ jobs:
6262
//k8s/${{ matrix.artifact }}:${{ matrix.artifact }}_image_list
6363
6464
# Ignore images whose basename is "/${{ matrix.artifact }}" to avoid scanning the bazel built images (e.g. /vizier-, /cloud-)
65-
cat ./bazel-bin/k8s/${{ matrix.artifact }}/${{ matrix.artifact }}_image_list.txt | grep -v "\/${{ matrix.artifact }}" | xargs -I{} sh -c 'trivy image {} --format=sarif --output=sarif/${{ matrix.artifact }}/$(basename {} | cut -d":" -f1).sarif'
65+
deps_output_dir=sarif/${{ matrix.artifact }}_deps
66+
cat ./bazel-bin/k8s/${{ matrix.artifact }}/${{ matrix.artifact }}_image_list.txt | grep -v "\/${{ matrix.artifact }}" | xargs -I{} sh -c 'trivy image {} --format=sarif --output=${deps_output_dir}/$(basename {} | cut -d":" -f1).sarif'
6667
# yamllint enable rule:line-length
6768
- run: |
68-
for f in "sarif/${{ matrix.artifact }}/"*; do
69+
# Loop through all ${artifact} and ${artifact}_deps sarif files
70+
for f in "sarif/${{ matrix.artifact }}"*/*; do
6971
jq '.runs[].tool.driver.name = "trivy-images"' < "$f" > tmp
7072
# The runAutomationDetails's object must contain a unique category as required by the CodeQL SARIF uploader
7173
# The id value will be interpreted like so: "${category}/${run_id}"
@@ -75,3 +77,9 @@ jobs:
7577
- uses: github/codeql-action/upload-sarif@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
7678
with:
7779
sarif_file: sarif/${{ matrix.artifact }}
80+
# TODO(ddelnano): Remove this check once the operator dependency images are supported. This requires rendering helm templates
81+
# and requires some additional work.
82+
- uses: github/codeql-action/upload-sarif@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
83+
if: ${{ matrix.artifact != 'operator' }}
84+
with:
85+
sarif_file: sarif/${{ matrix.artifact }}_deps

0 commit comments

Comments
 (0)