added trivy scanning
Some checks failed
/ test_build_docker (push) Failing after 36s

This commit is contained in:
Kai Reichart 2024-11-28 14:20:21 +01:00
parent 5b42ebca4b
commit 161bddc54b
3 changed files with 50 additions and 0 deletions

View file

@ -0,0 +1,6 @@
on: [push]
jobs:
test_build_docker:
uses: ./.github/workflows/trivy-image-scan.yml
with:
image: 'forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/build/test:latest'

23
.github/workflows/trivy-image-scan.yml vendored Normal file
View file

@ -0,0 +1,23 @@
name: Run Trivy Image Scanner
on:
workflow_call:
inputs:
image:
description: 'The image to test'
required: true
type: string
jobs:
build-go:
runs-on: docker
container:
image: forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/pipeline-container/trivy:0.56.2
steps:
- name: Clone Repository
uses: https://forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/DevFW-CICD/checkout@main
- name: Run trivy image scan
run: |
set -e
TRIVY_INSECURE=true trivy image --scanners license,vuln,secret ${{ inputs.image }}
TRIVY_INSECURE=true trivy image --image-config-scanners secret,misconfig ${{ inputs.image }}

View file

@ -0,0 +1,21 @@
# Run Trivy Image Scanner GitHub Action
This GitHub Action scans Docker images for vulnerabilities, secrets, licenses, and misconfigurations using [Trivy](https://github.com/aquasecurity/trivy).
## Inputs
| Input Name | Description | Required | Type |
|------------|-----------------------|----------|--------|
| `image` | The Docker image to scan. | Yes | string |
## Usage
This action can be used in other workflows with `workflow_call`. Heres an example:
```yaml
jobs:
scan:
uses:DevFW-CICD/vulnerability-scan/.github/workflows/trivy-image-scan.yml@main
with:
image: 'my-registry.com/project/image:latest'
```