From 6048a8781766ddedd47ba2b1643d28ffeae873ad Mon Sep 17 00:00:00 2001 From: Richard Case Date: Mon, 17 Jul 2023 10:07:26 +0100 Subject: [PATCH] feat: add image scanning workflow Signed-off-by: Richard Case --- .github/workflows/scan.yaml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/scan.yaml diff --git a/.github/workflows/scan.yaml b/.github/workflows/scan.yaml new file mode 100644 index 00000000..dad91276 --- /dev/null +++ b/.github/workflows/scan.yaml @@ -0,0 +1,37 @@ +name: Scan +on: + pull_request: + push: + branches: + - master + tags: + - "v*" +jobs: + scan: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Build binary + run: make build + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2.9.0 + - name: Build image + uses: docker/build-push-action@v4.1.1 + with: + context: . + tags: ghcr.io/rancher/gke-operator:${{ github.sha }} + load: true + push: false + file: package/Dockerfile + - name: Run Trivy vulnerability scanner + uses: aquasecurity/trivy-action@master + with: + image-ref: "ghcr.io/rancher/gke-operator:${{ github.sha }}" + format: "table" + exit-code: "1" + ignore-unfixed: true + severity: "CRITICAL,HIGH"