Skip to content

4.10.13+upstream4.9.0 #333

4.10.13+upstream4.9.0

4.10.13+upstream4.9.0 #333

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Vulnerability Scan
on:
workflow_dispatch:
release:
schedule:
- cron: '00 9 * * 1'
permissions:
contents: read
security-events: write
jobs:
version:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.version.outputs.tag }}
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
fetch-depth: 0
- name: Latest Tag
id: version
shell: bash
run: |
TAG=$(cat TAG)
echo "TAG: ${TAG}"
echo "::set-output name=tag::${TAG}"
scan:
runs-on: ubuntu-latest
needs: version
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- shell: bash
id: test
run: echo "Scanning registry.k8s.io/ingress-nginx/controller@${{ needs.version.outputs.tag }}"
- name: Scan image with AquaSec/Trivy
id: scan
uses: aquasecurity/trivy-action@7c2007bcb556501da015201bcba5aa14069b74e2 #v0.5.1
with:
image-ref: docker.io/wallarm/ingress-controller:${{ needs.version.outputs.tag }}
format: 'sarif'
output: trivy-results-${{ needs.version.outputs.tag }}.sarif
exit-code: 0
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH,MEDIUM,LOW,UNKNOWN'
- name: Output Sarif File
shell: bash
run: cat ${{ github.workspace }}/trivy-results-${{ needs.version.outputs.tag }}.sarif
# This step checks out a copy of your repository.
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@23acc5c183826b7a8a97bce3cecc52db901f8251 # v2.1.37
with:
token: ${{ github.token }}
# Path to SARIF file relative to the root of the repository
sarif_file: ${{ github.workspace }}/trivy-results-${{ needs.version.outputs.tag }}.sarif
- name: Vulz Count
shell: bash
run: |
TRIVY_COUNT=$(cat ${{ github.workspace }}/trivy-results-${{ needs.version.outputs.tag }}.sarif | jq '.runs[0].results | length')
echo "TRIVY_COUNT: $TRIVY_COUNT"
echo "Image Vulnerability scan output" >> $GITHUB_STEP_SUMMARY
echo "Image ID: registry.k8s.io/ingress-nginx/controller@${{ needs.version.outputs.tag }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Trivy Count: $TRIVY_COUNT" >> $GITHUB_STEP_SUMMARY