forked from fluent/fluent-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (63 loc) · 2.2 KB
/
scan-docker-image-action.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
name: Reusable workflow for Trivy and Dockle to scan images
on:
workflow_call:
inputs:
platforms:
description: The platform to scan the image
required: true
type: string
default: '["linux/arm64", "linux/amd64"]'
source_image:
description: The image to clone
required: true
type: string
source_registry:
description: Image registry from which to pull the image
required: true
type: string
secrets:
registry_password:
description: The Github token or similar to authenticate with for the registry.
required: true
registry_username:
description: The username to authenticate with for the registry.
required: true
jobs:
scan:
strategy:
matrix:
platform: ${{ fromJson(inputs.platforms) }}
runs-on: ubuntu-latest
name: Trivy + Dockle image scan
steps:
- name: Login to ${{ inputs.source_registry }}
uses: docker/login-action@v3
with:
registry: ${{ inputs.source_registry }}
username: ${{ secrets.registry_username }}
password: ${{ secrets.registry_password }}
- name: Display platform
run: |
echo "Platform: ${{ matrix.platform }}"
- name: check docker image exists
run: |
docker pull --platform ${{ matrix.platform }} ${{ inputs.source_registry }}/${{ inputs.source_image }}
- name: Trivy - multi-arch
uses: aquasecurity/[email protected]
with:
image-ref: ${{ inputs.source_registry }}/${{ inputs.source_image }}
format: "table"
exit-code: "1"
ignore-unfixed: true
vuln-type: "os,library"
severity: "CRITICAL,HIGH"
trivy-config: trivy.yaml
env:
TRIVY_PLATFORM: ${{ matrix.platform }}
- name: Dockle - multi-arch
uses: hands-lab/dockle-action@v1
with:
image: ${{ inputs.source_registry }}/${{ inputs.source_image }}
exit-code: "0"
exit-level: WARN