Skip to content

Commit c1dd67d

Browse files
committed
build: New workflow to trigger patch releases
Signed-off-by: Paulo Gomes <[email protected]>
1 parent 778cfd1 commit c1dd67d

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Check latest images for CVEs
2+
on:
3+
schedule:
4+
- cron: 0 9 10,20,30 * *
5+
workflow_dispatch:
6+
7+
permissions:
8+
issues: write
9+
contents: read
10+
11+
jobs:
12+
check-released-images:
13+
strategy:
14+
matrix:
15+
include:
16+
- branch: release/v1.3
17+
18+
name: Scanning ${{ matrix.image }}
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
token: ${{ github.token }}
25+
sparse-checkout: |
26+
.github
27+
28+
- name: Fetch current image
29+
run: |
30+
IMAGE=rancher/cis-operator
31+
32+
wget -O chart-values.yaml https://raw.githubusercontent.com/rancher/cis-operator/refs/heads/${{ matrix.branch }}/chart/values.yaml
33+
IMAGE_VERSION=$(grep -A1 "${IMAGE}" chart-values.yaml | grep "tag:" | awk '{print $2}')
34+
echo "LATEST_OPERATOR_IMG=${IMAGE}:${IMAGE_VERSION}" >> "$GITHUB_ENV"
35+
36+
- name: Scanning ${{ env.LATEST_OPERATOR_IMG }}
37+
id: vuln-scanner
38+
uses: aquasecurity/[email protected]
39+
with:
40+
image-ref: ${{ env.LATEST_OPERATOR_IMG }}
41+
scan-type: image
42+
scanners: vuln
43+
format: table
44+
output: cve-report.txt
45+
exit-code: 1
46+
ignore-unfixed: true
47+
vuln-type: os,library
48+
severity: LOW,MEDIUM,CRITICAL,HIGH
49+
continue-on-error: true
50+
env:
51+
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db
52+
TRIVY_JAVA_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-java-db
53+
TRIVY_DISABLE_VEX_NOTICE: true
54+
55+
- name: Create issue for ${{ matrix.branch }}
56+
if: steps.vuln-scanner.outcome == 'failure'
57+
run: |
58+
if [ ! -s cve-report.txt ]
59+
then
60+
echo "report file not found: exiting early"
61+
exit 1
62+
fi
63+
64+
echo "A new release is needed to mitigate CVEs in ${{ env.LATEST_OPERATOR_IMG }}:" > issue.txt
65+
echo '' >> issue.txt
66+
echo '```' >> issue.txt
67+
cat cve-report.txt | head -c65000 >> issue.txt
68+
echo '```' >> issue.txt
69+
70+
gh issue create \
71+
--title "${{ env.ISSUE_TITLE }}" \
72+
--body-file issue.txt
73+
env:
74+
GH_TOKEN: ${{ github.token }}
75+
ISSUE_TITLE: Patch release for ${{ matrix.branch }}

0 commit comments

Comments
 (0)