-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (72 loc) · 2.26 KB
/
test-tools.yml
File metadata and controls
85 lines (72 loc) · 2.26 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Test Tools Image
on:
push:
branches: [main]
paths:
- 'test-tools/**'
tags:
- 'test-tools-v*'
jobs:
build-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
security-events: write
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine tags
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/disentangle-network/test-tools
tags: |
type=match,pattern=test-tools-v(.*),group=1
type=raw,value=latest
- name: Build and push multi-arch image
id: build
uses: docker/build-push-action@v6
with:
context: ./test-tools
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.28.0
with:
image-ref: ghcr.io/disentangle-network/test-tools:latest
format: sarif
output: trivy-results.sarif
severity: CRITICAL,HIGH
- name: Upload Trivy scan results
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: trivy-results.sarif
- name: Install cosign
uses: sigstore/cosign-installer@v3
- name: Sign image by digest
env:
COSIGN_EXPERIMENTAL: "true"
run: |
cosign sign --yes ghcr.io/disentangle-network/test-tools@${{ steps.build.outputs.digest }}
- name: Generate SBOM
uses: anchore/sbom-action@v0
with:
image: ghcr.io/disentangle-network/test-tools:latest
format: spdx-json
output-file: sbom.spdx.json
- name: Attach SBOM to image
run: |
cosign attach sbom --sbom sbom.spdx.json ghcr.io/disentangle-network/test-tools@${{ steps.build.outputs.digest }}