-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Pete Wall <[email protected]>
- Loading branch information
Showing
2 changed files
with
68 additions
and
7 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,67 @@ | ||
--- | ||
name: Scan Chart Images | ||
|
||
on: | ||
Check failure on line 4 in .github/workflows/scan-chart-images.yml GitHub Actions / runner / yamllint
|
||
push: | ||
branches: ["main"] | ||
paths: | ||
- 'charts/k8s-monitoring/docs/examples/**' | ||
pull_request: | ||
paths: | ||
- 'charts/k8s-monitoring/docs/examples/**' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
list-container-images: | ||
name: List Container Images | ||
runs-on: ubuntu-latest | ||
outputs: | ||
images: ${{ steps.list_images.outputs.images }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install yq | ||
uses: dcarbone/[email protected] | ||
|
||
- name: List Container Images | ||
id: list_images | ||
working-directory: charts/k8s-monitoring | ||
run: | | ||
files=$(find docs/examples -name output.yaml) | ||
touch images.txt | ||
for file in $files; do | ||
if [ "${file}" == "docs/examples/private-image-registries/output.yaml" ]; then | ||
continue | ||
fi | ||
{ | ||
yq -r -o json '. | select(.kind=="DaemonSet") | .spec.template.spec.containers[].image' "${file}" | ||
yq -r -o json '. | select(.kind=="Deployment") | .spec.template.spec.containers[].image' "${file}" | ||
yq -r -o json '. | select(.kind=="Job") | .spec.template.spec.containers[].image' "${file}" | ||
yq -r -o json '. | select(.kind=="Pod") | .spec.containers[].image' "${file}" | ||
yq -r -o json '. | select(.kind=="StatefulSet") | .spec.template.spec.containers[].image' "${file}" | ||
} >> images.txt | ||
done | ||
echo "images=$(sort --unique < images.txt | jq --raw-input --slurp --compact-output 'split("\n") | map(select(. != ""))')" >> "${GITHUB_OUTPUT}" | ||
scan-container-images: | ||
name: Scan Container Images | ||
needs: list-container-images | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
image: ${{ fromJson(needs.list-container-images.outputs.images) }} | ||
fail-fast: false | ||
steps: | ||
- name: Run Trivy | ||
uses: aquasecurity/[email protected] | ||
with: | ||
token-setup-trivy: ${{ secrets.GITHUB_TOKEN }} | ||
image-ref: ${{ matrix.image }} | ||
format: sarif | ||
output: trivy-results.sarif | ||
|
||
- name: Upload Trivy scan results to GitHub Security tab | ||
uses: github/codeql-action/upload-sarif@v3 | ||
with: | ||
sarif_file: trivy-results.sarif |
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 |
---|---|---|
|
@@ -80,17 +80,11 @@ jobs: | |
- name: Install Helm | ||
uses: azure/setup-helm@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.9' | ||
check-latest: true | ||
|
||
- name: Set up chart-testing | ||
uses: helm/chart-testing-action@v2 | ||
|
||
- name: Install yq | ||
run: pip install yq | ||
uses: dcarbone/install[email protected] | ||
|
||
- name: Install ShellSpec | ||
run: | | ||
|