-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: New workflow to trigger patch releases
Signed-off-by: Paulo Gomes <[email protected]>
- Loading branch information
Showing
1 changed file
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Check latest images for CVEs | ||
on: | ||
schedule: | ||
- cron: 0 9 10,20,30 * * | ||
workflow_dispatch: | ||
|
||
permissions: | ||
issues: write | ||
contents: read | ||
|
||
jobs: | ||
check-released-images: | ||
strategy: | ||
matrix: | ||
include: | ||
- branch: release/v1.3 | ||
- branch: release/v1.2 | ||
- branch: release/v1.1 | ||
|
||
name: Scanning ${{ matrix.image }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ github.token }} | ||
sparse-checkout: | | ||
.github | ||
- name: Fetch current image | ||
run: | | ||
IMAGE=rancher/cis-operator | ||
wget -O chart-values.yaml https://raw.githubusercontent.com/rancher/cis-operator/refs/heads/${{ matrix.branch }}/chart/values.yaml | ||
IMAGE_VERSION=$(grep -A1 "${IMAGE}" chart-values.yaml | grep "tag:" | awk '{print $2}') | ||
echo "LATEST_OPERATOR_IMG=${IMAGE}:${IMAGE_VERSION}" >> "$GITHUB_ENV" | ||
- name: Scanning ${{ env.LATEST_OPERATOR_IMG }} | ||
id: vuln-scanner | ||
uses: aquasecurity/[email protected] | ||
with: | ||
image-ref: ${{ env.LATEST_OPERATOR_IMG }} | ||
scan-type: image | ||
scanners: vuln | ||
format: table | ||
output: cve-report.txt | ||
exit-code: 1 | ||
ignore-unfixed: true | ||
vuln-type: os,library | ||
severity: LOW,MEDIUM,CRITICAL,HIGH | ||
continue-on-error: true | ||
env: | ||
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db | ||
TRIVY_JAVA_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-java-db | ||
TRIVY_DISABLE_VEX_NOTICE: true | ||
|
||
- name: Create issue for ${{ matrix.branch }} | ||
if: steps.vuln-scanner.outcome == 'failure' | ||
run: | | ||
if [ ! -s cve-report.txt ] | ||
then | ||
echo "report file not found: exiting early" | ||
exit 1 | ||
fi | ||
echo "A new release is needed to mitigate CVEs in ${{ env.LATEST_OPERATOR_IMG }}:" > issue.txt | ||
echo '' >> issue.txt | ||
echo '```' >> issue.txt | ||
cat cve-report.txt | head -c65000 >> issue.txt | ||
echo '```' >> issue.txt | ||
gh issue create \ | ||
--title "${{ env.ISSUE_TITLE }}" \ | ||
--body-file issue.txt | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
ISSUE_TITLE: Patch release for ${{ matrix.branch }} |