-
Notifications
You must be signed in to change notification settings - Fork 50
91 lines (86 loc) · 2.86 KB
/
scan-images.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Scan images
on:
schedule:
# every day at 1:12AM UTC
- cron: '12 1 * * *'
workflow_dispatch:
jobs:
get-images:
name: Get images
runs-on: ubuntu-22.04
strategy:
matrix:
# specify location of bundle(s) to be scanned
bundle:
- releases/1.8/stable/kubeflow
- releases/1.9/stable
- releases/latest/edge
steps:
- name: Clone and checkout canonical/kubeflow-ci
uses: actions/checkout@v3
with:
repository: canonical/kubeflow-ci.git
sparse-checkout: scripts/images/
ref: main
path: kubeflow-ci
- name: Run get-all-images.py
uses: actions/checkout@v4
run: |
BUNDLE="${{ matrix.bundle }}"
BUNDLE_SPLIT=(${BUNDLE//\// })
RELEASE=${BUNDLE_SPLIT[1]}
RISK=${BUNDLE_SPLIT[2]}
pip3 install -r scripts/requirements.txt
python3 scripts/get-all-images.py ${{ matrix.bundle }}/bundle.yaml > /tmp/image_list.txt
echo "Image list:"
cat /tmp/image_list.txt
echo "release_risk=${RELEASE}-${RISK}" >> $GITHUB_OUTPUT
# Output the images as an array that can be used in the matrix strategy of the next step
# This array contains all the images from /tmp/image_list.txt
sudo snap install jq
DATA=$(cat images.txt | jq -R -s -c 'split("\n")[:-1]')
echo "matrix=$DATA" >> "$GITHUB_OUTPUT"
# scan-images:
# name: Scan images in bundle
# runs-on: ubuntu-22.04
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
#
# - name: Setup tools
# id: setup
# run: |
# sudo snap install yq
# echo "date=$(date '+%Y-%m-%d-%H-%M-%S')" >> $GITHUB_OUTPUT
#
#
#
# - name: Run Trivy vulnerability scanner
# uses: aquasecurity/[email protected]
# with:
# image-ref: ${{ matrix.image }}
# output: ${{ format('/tmp/trivy-reports/{0}.json', matrix.image) }}
# format: 'json'
# exit-code: '1'
# ignore-unfixed: true
# severity: 'CRITICAL,HIGH'
# strategy:
# matrix:
# image: ${{ fromJSON(needs.images.outputs.matrix) }}
#
# - name: Prepare artifacts
# run: |
# tar zcvf trivy-reports-${{ steps.setup.outputs.date}}-${{ steps.images.outputs.release_risk }}-${{ strategy.job-index }}.tar.gz /tmp/trivy-reports
#
# - name: Upload Trivy reports
# uses: actions/upload-artifact@v3
# with:
# name: trivy-reports
# path: trivy-reports-${{ steps.setup.outputs.date}}-${{ steps.images.outputs.release_risk }}-${{ strategy.job-index }}.tar.gz
# - name: Upload summary
# uses: actions/upload-artifact@v3
# with:
# name: summary
# path: scan-summary-${{ steps.setup.outputs.date}}-${{ steps.images.outputs.release_risk }}.csv