ci: Add periodic code scan
This commit is contained in:
2
.github/workflows/build-and-test.yml
vendored
2
.github/workflows/build-and-test.yml
vendored
@@ -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
29
.github/workflows/code-scanning.yml
vendored
Normal 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'
|
||||
Reference in New Issue
Block a user