Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add container scanning for OSS images #1580

Merged
merged 1 commit into from
May 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/edge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,64 @@ jobs:
- name: Run Tests
run: go test ./...

container-scan:
name: Container Scanning
runs-on: ubuntu-20.04
needs: binary
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Fetch Cached Artifacts
uses: actions/[email protected]
with:
path: ${{ github.workspace }}/dist
key: nginx-ingress-${{ github.run_id }}-${{ github.run_number }}
- name: Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver-opts: network=host
- name: Cache Docker layers
uses: actions/[email protected]
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build ${{ matrix.image }} Container
uses: docker/build-push-action@v2
with:
file: build/Dockerfile
context: '.'
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
target: goreleaser
tags: ${{ matrix.image }}:${{ github.sha }}
load: true
build-args: |
BUILD_OS=${{ matrix.image }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: '${{ matrix.image }}:${{ github.sha }}'
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results-${{ matrix.image }}.sarif'
ignore-unfixed: 'true'
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: 'trivy-results-${{ matrix.image }}.sarif'
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
- name: Upload Scan Results
uses: actions/upload-artifact@v2
with:
name: 'trivy-results-${{ matrix.image }}.sarif'
path: 'trivy-results-${{ matrix.image }}.sarif'
if: always()
strategy:
matrix:
image: [debian, alpine, opentracing, openshift]

smoke-tests:
name: Smoke Tests
runs-on: ${{ matrix.os }}
Expand Down