adds trivy for image scanning

Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
Raffaele Di Fazio 2021-09-24 12:25:37 +00:00 committed by GitHub
parent 8cc952298c
commit 37b7e63d5c
2 changed files with 32 additions and 0 deletions

29
.github/workflows/trivy.yml vendored Normal file
View File

@ -0,0 +1,29 @@
name: trivy vulnerability scanner
on:
push:
branches:
- master
pull_request:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build an image from Dockerfile
run: |
make build.docker
- uses: cachix/install-nix-action@v13
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: workflow/nix-shell-action@v1
env:
with:
packages: trivy
script: |
make build.docker
./scripts/run-trivy.sh

3
scripts/run-trivy.sh Executable file
View File

@ -0,0 +1,3 @@
#! /bin/bash
trivy image --exit-code 1 us.gcr.io/k8s-artifacts-prod/external-dns/external-dns:$(git describe --tags --always --dirty)