-
Notifications
You must be signed in to change notification settings - Fork 10
170 lines (151 loc) · 5.85 KB
/
release.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
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
160
161
162
163
164
165
166
167
168
169
170
name: Release
on:
push:
tags:
- "*.*"
jobs:
build-trivy-operator:
name: Build trivy-operator
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: true
- run: |
echo "TRIVY=$(curl --silent https://api.github.com/repos/aquasecurity/trivy/releases/latest | jq -r .name | cut -d 'v' -f2)" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Prepare trivy
id: prep_trivy
run: |
cp trivy-operator.py docker/trivy-operator/trivy-operator.py
# amd64
wget -q -O /tmp/trivy.tar.gz https://github.com/aquasecurity/trivy/releases/download/v${{env.TRIVY}}/trivy_${{env.TRIVY}}_Linux-64bit.tar.gz
tar -C /tmp -xf /tmp/trivy.tar.gz
mkdir docker/trivy-operator/amd64
cp /tmp/trivy docker/trivy-operator/amd64/trivy
rm -f /tmp/trivy.tar.gz /tmp/trivy
# arm64v8
wget -q -O /tmp/trivy.tar.gz https://github.com/aquasecurity/trivy/releases/download/v${{env.TRIVY}}/trivy_${{env.TRIVY}}_Linux-ARM64.tar.gz
tar -C /tmp -xf /tmp/trivy.tar.gz
mkdir docker/trivy-operator/arm64v8
cp /tmp/trivy docker/trivy-operator/arm64v8/trivy
rm -f /tmp/trivy.tar.gz /tmp/trivy
- name: Build amd64 trivy-operator
uses: docker/[email protected]
with:
context: docker/trivy-operator/
build-args:
ARCH=amd64/
tags: devopstales/trivy-operator:${{github.ref_name}}-amd64
push: true
provenance: false
- name: Build arm64v8 trivy-operator
uses: docker/[email protected]
with:
context: docker/trivy-operator/
build-args:
ARCH=arm64v8/
tags: devopstales/trivy-operator:${{github.ref_name}}-arm64v8
push: true
provenance: false
- name: Create and push trivy-operator manifest images
uses: Noelware/docker-manifest-action@master
with:
inputs: devopstales/trivy-operator:${{github.ref_name}}
images: devopstales/trivy-operator:${{github.ref_name}}-amd64,devopstales/trivy-operator:${{github.ref_name}}-arm64v8
push: true
build-kube-bench-scnner:
name: Build kube-bench-scnner
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: true
- run: |
echo "BENCH=$(curl --silent https://api.github.com/repos/aquasecurity/kube-bench/releases/latest | jq -r .name | cut -d "v" -f2)" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Prepare kube-bench
id: prep_kube-bench
run: |
cp kube-bench-scnner.py docker/kube-bench-scnner/kube-bench-scnner.py
# amd64 kube-bench
wget -q -O /tmp/kube-bench.tar.gz https://github.com/aquasecurity/kube-bench/releases/download/v${{env.BENCH}}/kube-bench_${{env.BENCH}}_linux_amd64.tar.gz
tar -C /tmp -xf /tmp/kube-bench.tar.gz
mkdir docker/kube-bench-scnner/amd64
cp /tmp/kube-bench docker/kube-bench-scnner/amd64/kube-bench
rm -rf /tmp/kube-bench.tar.gz /tmp/kube-bench
# arm64v8
wget -q -O /tmp/kube-bench.tar.gz https://github.com/aquasecurity/kube-bench/releases/download/v${{env.BENCH}}/kube-bench_${{env.BENCH}}_linux_arm64.tar.gz
tar -C /tmp -xf /tmp/kube-bench.tar.gz
mkdir docker/kube-bench-scnner/arm64v8
cp /tmp/kube-bench docker/kube-bench-scnner/arm64v8/kube-bench
rm -rf /tmp/kube-bench.tar.gz /tmp/kube-bench
- name: Build amd64 kube-bench-scnner
uses: docker/[email protected]
with:
context: docker/kube-bench-scnner/
build-args:
ARCH=amd64/
tags: devopstales/kube-bench-scnner:${{github.ref_name}}-amd64
push: true
provenance: false
- name: Build arm64v8 kube-bench-scnner
uses: docker/[email protected]
with:
context: docker/kube-bench-scnner/
build-args:
ARCH=arm64v8/
tags: devopstales/kube-bench-scnner:${{github.ref_name}}-arm64v8
push: true
provenance: false
- name: Create and push kube-bench-scnner manifest images
uses: Noelware/docker-manifest-action@master
with:
inputs: devopstales/kube-bench-scnner:${{github.ref_name}}
images: devopstales/kube-bench-scnner:${{github.ref_name}}-amd64,devopstales/kube-bench-scnner:${{github.ref_name}}-arm64v8
push: true
release:
name: Create Release
runs-on: ubuntu-20.04
needs:
- build-trivy-operator
- build-kube-bench-scnner
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{github.ref_name}}
release_name: Release ${{github.ref_name}}
body: |
### Changes in this Release
draft: true
prerelease: false