-
Notifications
You must be signed in to change notification settings - Fork 7
159 lines (139 loc) · 5.85 KB
/
build_tiber.yml
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: dockerfiles-build
on:
workflow_call:
workflow_dispatch:
pull_request:
push:
branches: [ "main" ]
permissions:
contents: read
env:
BUILD_TYPE: "Release"
DOCKER_IMAGE_BASE: "ghcr.io/openvisualcloud/intel-tiber-broadcast-suite"
DOCKER_IMAGE_NAME: "tiber-broadcast-suite"
DOCKER_IMAGE_TAG: "${{ github.sha }}"
DEBIAN_FRONTEND: "noninteractive"
TRIVY_DB_REPOSITORY: "public.ecr.aws/aquasecurity/trivy-db"
TRIVY_JAVA_DB_REPOSITORY: "public.ecr.aws/aquasecurity/trivy-java-db"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
docker:
name: "Dockerfile build for Intel® Tiber™ Broadcast Suite"
runs-on: ubuntu-22.04
timeout-minutes: 120
permissions:
contents: read
security-events: write
env:
BUILDKIT_STEP_LOG_MAX_SIZE: 50000000
BUILDKIT_STEP_LOG_MAX_SPEED: 10000000
DOCKER_TMPDIR: "/mnt/docker/docker-tmp"
steps:
- name: "OS-Configuration: Preparation: Harden Runner"
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
- name: "OS-Configuration: Report memory, block-dev and free disk space."
run: |
sudo free -h
sudo lsblk
sudo df -h
- name: "OS-Configuration: Disable SWAP in OS, create mnt points, show settings."
shell: bash
run: |
export SWAP_FILE="$(sudo swapon --show=NAME | tail -n 1)"
sudo swapoff "${SWAP_FILE}"
sudo rm "${SWAP_FILE}"
sudo mkdir -p "/mnt/docker/docker-d" "/mnt/docker/docker-tmp"
- name: "OS-Configuration: Add data-root and other JSON changes to dockerd, reload it."
run: |
sudo chmod 666 /etc/docker/daemon.json
echo "$(sudo jq '. += {"data-root":"/mnt/docker/docker-d","log-driver":"json-file","log-format":"text","log-level":"info","log-opts":{"cache-disabled":"false","cache-max-file":"5","cache-max-size":"20m","max-file":"5","max-size":"10m"}}' /etc/docker/daemon.json)" > /etc/docker/daemon.json
sudo chmod 644 /etc/docker/daemon.json
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo cat "/etc/docker/daemon.json"
- name: "Configuration: Docker with Buildx Toolkit set up"
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
with:
buildkitd-flags: "--debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host"
platforms: "linux/amd64"
driver-opts: memory=14Gib,memory-swap=25Gib,env.BUILDKIT_STEP_LOG_MAX_SIZE=50000000,env.BUILDKIT_STEP_LOG_MAX_SPEED=10000000
- name: "Validation: Build/Push Dokcerfile"
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5.4.0
with:
file: Dockerfile
push: false
load: true
target: final-stage
tags: "${{ env.DOCKER_IMAGE_BASE }}/${{ env.DOCKER_IMAGE_NAME }}:${{ env.DOCKER_IMAGE_TAG }}"
platforms: "linux/amd64"
cache-from: type=gha,scope=${{ env.DOCKER_IMAGE_NAME }}
cache-to: type=gha,mode=max,scope=${{ env.DOCKER_IMAGE_NAME }}
- name: "Validation: Run Trivy vulnerability scanner on image"
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # v0.29.0
continue-on-error: true
with:
image-ref: "${{ env.DOCKER_IMAGE_BASE }}/${{ env.DOCKER_IMAGE_NAME }}:${{ env.DOCKER_IMAGE_TAG }}"
output: "trivy-image-scan-tiber-${{ env.DOCKER_IMAGE_TAG }}.sarif"
format: "sarif"
- name: "Finish: Upload Trivy scan results to GitHub Security tab"
uses: github/codeql-action/upload-sarif@2e230e8fe0ad3a14a340ad0815ddb96d599d2aff # v3.25.8
continue-on-error: true
with:
sarif_file: "trivy-image-scan-tiber-${{ env.DOCKER_IMAGE_TAG }}.sarif"
trivy-config-scan:
name: "trivy config scans"
runs-on: ubuntu-22.04
permissions:
contents: read
security-events: write
steps:
- name: "Preparation: Harden Runner"
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
- name: "Preparation: Repository Checkout"
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Run Trivy 'config' type vulnerability scan.
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # v0.29.0
with:
scan-type: 'config'
hide-progress: false
ignore-unfixed: true
format: 'sarif'
output: 'trivy-config-scan-tiber.sarif'
severity: 'CRITICAL,HIGH,MEDIUM'
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@2e230e8fe0ad3a14a340ad0815ddb96d599d2aff # v3.25.8
if: always()
with:
sarif_file: 'trivy-config-scan-tiber.sarif'
trivy-fs-scan:
name: "trivy fs scans"
runs-on: ubuntu-22.04
permissions:
contents: read
security-events: write
steps:
- name: "Preparation: Harden Runner"
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
- name: "Preparation: Repository Checkout"
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Run Trivy 'fs' type vulnerability scanner.
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # v0.29.0
with:
scan-type: 'fs'
ignore-unfixed: true
format: 'sarif'
output: 'trivy-fs-scan-tiber.sarif'
severity: 'CRITICAL,HIGH,MEDIUM'
- name: Upload Trivy scan results to GitHub Security tab
if: always()
uses: github/codeql-action/upload-sarif@2e230e8fe0ad3a14a340ad0815ddb96d599d2aff # v3.25.8
with:
sarif_file: 'trivy-fs-scan-tiber.sarif'