forked from bank-vaults/bank-vaults
-
Notifications
You must be signed in to change notification settings - Fork 0
288 lines (228 loc) · 7.42 KB
/
ci.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
name: CI
on: [pull_request]
env:
GO_VERSION: 1.19.2
jobs:
checks:
name: Checks
runs-on: ubuntu-latest
services:
vault:
image: vault:1.6.2
env:
SKIP_SETCAP: true
VAULT_DEV_ROOT_TOKEN_ID: 227e1cce-6bf7-30bb-2d2a-acc854318caf
ports:
- 8200:8200
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0 # chart testing fails otherwise
- name: Check licenses
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make license-check
- name: Set up chart-testing
uses: helm/[email protected]
- name: Run chart-testing
run: ct lint --debug --config charts/testing.yaml
- name: Setup test dependencies
run: |
sudo apt install opensc softhsm
sudo mkdir -p /var/lib/softhsm/tokens/
sudo softhsm2-util --init-token --free --label bank-vaults --so-pin banzai --pin banzai
sudo pkcs11-tool --module /usr/lib/softhsm/libsofthsm2.so --keypairgen --key-type rsa:2048 --pin banzai --token-label bank-vaults --label bank-vaults
sudo chown -R runner:docker /etc/softhsm /var/lib/softhsm
- name: Run verification
run: make check
env:
VAULT_TOKEN: 227e1cce-6bf7-30bb-2d2a-acc854318caf
build-bank-vaults:
name: Build bank-vaults
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
tags: bank-vaults:latest
outputs: type=docker,dest=/tmp/bank-vaults.tar
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: bank-vaults
path: /tmp/bank-vaults.tar
build-vault-secrets-webhook:
name: Build webhook
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile.webhook
tags: vault-secrets-webhook:latest
outputs: type=docker,dest=/tmp/vault-secrets-webhook.tar
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: vault-secrets-webhook
path: /tmp/vault-secrets-webhook.tar
build-vault-operator:
name: Build operator
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile.operator
tags: vault-operator:latest
outputs: type=docker,dest=/tmp/vault-operator.tar
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: vault-operator
path: /tmp/vault-operator.tar
build-vault-env:
name: Build vault-env
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile.vault-env
tags: vault-env:latest
outputs: type=docker,dest=/tmp/vault-env.tar
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: vault-env
path: /tmp/vault-env.tar
# # Uncomment for debugging with SSH
# - name: Setup upterm session
# uses: lhotari/action-upterm@v1
# with:
# ## limits ssh access and adds the ssh public key for the user which triggered the workflow
# limit-access-to-actor: true
# ## limits ssh access and adds the ssh public keys of the listed GitHub users
# limit-access-to-users: bonifaido
acceptance-test:
name: Acceptance test
runs-on: ubuntu-latest
needs: [build-bank-vaults, build-vault-operator, build-vault-env, build-vault-secrets-webhook]
strategy:
matrix:
k8s_version: ["v1.25.8", "v1.24.12", "v1.23.17"]
vault_version: ["1.13.1", "1.12.5", "1.11.9", "1.10.11"]
env:
KURUN_VERSION: "0.6.4"
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Checkout code
uses: actions/checkout@v3
- name: Start kind cluster
run: |
kind version
kind create cluster --config test/kind.yaml --image kindest/node:${{ matrix.k8s_version }} --wait 1m
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Download Bank-Vaults docker image
uses: actions/download-artifact@v3
with:
name: bank-vaults
path: /tmp
- name: Download operator docker image
uses: actions/download-artifact@v3
with:
name: vault-operator
path: /tmp
- name: Download vault-env docker image
uses: actions/download-artifact@v3
with:
name: vault-env
path: /tmp
- name: Download webhook docker image
uses: actions/download-artifact@v3
with:
name: vault-secrets-webhook
path: /tmp
- name: Load Docker images to kind
run: |
kind load image-archive /tmp/bank-vaults.tar
kind load image-archive /tmp/vault-operator.tar
kind load image-archive /tmp/vault-env.tar
kind load image-archive /tmp/vault-secrets-webhook.tar
- name: Install kurun
run: |
curl -Lo kurun https://github.com/banzaicloud/kurun/releases/download/${KURUN_VERSION}/kurun-linux-amd64 && chmod +x kurun && sudo mv kurun /usr/local/bin/
- name: Acceptance test
run: go test -v -timeout 900s -tags kubeall ./test
env:
VAULT_VERSION: ${{ matrix.vault_version }}
multi-cluster-acceptance-test:
name: Operator multi-cluster acceptance test
runs-on: ubuntu-latest
needs: build-vault-operator
env:
GO_VERSION: "1.19.2"
K8S_VERSION: "v1.23.4"
HELM_VERSION: "v3.8.0"
KIND_VERSION: "v0.12.0"
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Checkout code
uses: actions/checkout@v3
- uses: azure/setup-helm@v3
with:
version: ${{ env.HELM_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
- uses: engineerd/[email protected]
with:
version: ${{ env.KIND_VERSION }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Download operator docker image
uses: actions/download-artifact@v3
with:
name: vault-operator
path: /tmp
- name: Install envtpl
run: go install github.com/subfuzion/envtpl/...@428c2d7
- name: Install cidr
run: go install github.com/hankjacobs/cidr@master
- name: Build the Helm charts
run: |
helm dep build ./charts/vault-operator
- name: Operator Multi-DC Raft test
run: |
./operator/deploy/multi-dc/test/multi-dc-raft.sh install