ci: Add periodic code scan

This commit is contained in:
Carlos Álvaro
2020-10-14 19:18:48 +02:00
parent 9e86e3aed8
commit 581808b8fa
3 changed files with 42 additions and 9 deletions

View File

@@ -6,7 +6,7 @@ on:
- master
env:
IMAGE_NAME: localhost:5000/cdalvaro/docker-salt-master:ci
IMAGE_NAME: localhost:5000/cdalvaro/docker-salt-master:${{ github.sha }}
REGISTRY_PATH: ${{ github.workspace }}/registry
CACHE_PATH: /tmp/.buildx-cache

29
.github/workflows/code-scanning.yml vendored Normal file
View File

@@ -0,0 +1,29 @@
name: "Code Scanning"
on:
schedule:
- cron: '0 0 * * 1'
jobs:
code-scan:
name: Trivy scan
runs-on: ubuntu-latest
steps:
- name: Download and tag latest image
run: |
docker pull ghcr.io/cdalvaro/docker-salt-master:latest
docker tag ghcr.io/cdalvaro/docker-salt-master:latest ghcr.io/cdalvaro/docker-salt-master:${{ github.sha }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'ghcr.io/cdalvaro/docker-salt-master:${{ github.sha }}'
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results.sarif'
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: 'trivy-results.sarif'