-
Notifications
You must be signed in to change notification settings - Fork 62
176 lines (150 loc) · 6.78 KB
/
test.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
name: 'Test Charts'
on: 'pull_request'
jobs:
test:
runs-on: 'ubuntu-20.04'
permissions:
contents: 'read'
id-token: 'write'
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
k8s:
- version: v1.21
kindest-image-tag: 'v1.21.14@sha256:8a4e9bb3f415d2bb81629ce33ef9c76ba514c14d707f9797a01e3216376ba093'
- version: v1.22
kindest-image-tag: 'v1.22.17@sha256:f5b2e5698c6c9d6d0adc419c0deae21a425c07d81bbf3b6a6834042f25d4fba2'
- version: v1.23
kindest-image-tag: 'v1.23.17@sha256:59c989ff8a517a93127d4a536e7014d28e235fb3529d9fba91b3951d461edfdb'
- version: v1.24
kindest-image-tag: 'v1.24.15@sha256:7db4f8bea3e14b82d12e044e25e34bd53754b7f2b0e9d56df21774e6f66a70ab'
- version: v1.25
kindest-image-tag: 'v1.25.11@sha256:227fa11ce74ea76a0474eeefb84cb75d8dad1b08638371ecf0e86259b35be0c8'
- version: v1.26
kindest-image-tag: 'v1.26.6@sha256:6e2d8b28a5b601defe327b98bd1c2d1930b49e5d8c512e1895099e4504007adb'
- version: v1.27
kindest-image-tag: 'v1.27.3@sha256:3966ac761ae0136263ffdb6cfd4db23ef8a83cba8a463690e98317add2c9ba72'
- version: v1.28
kindest-image-tag: 'v1.28.0@sha256:9f3ff58f19dcf1a0611d11e8ac989fdb30a28f40f236f59f0bea31fb956ccf5c'
helm-version:
- latest
include:
- k8s:
version: v1.28
kindest-image-tag: 'v1.28.0@sha256:9f3ff58f19dcf1a0611d11e8ac989fdb30a28f40f236f59f0bea31fb956ccf5c'
helm-version: v3.9.0
name: 'K8s version ${{ matrix.k8s.version }} - Helm version ${{ matrix.helm-version }}'
steps:
- id: 'checkout'
name: Check The Repo Out
uses: 'actions/checkout@v3'
with:
fetch-depth: 0
- id: 'set-up-helm'
name: Install Helm (The Chart Testing CLI Depends On It)
uses: 'azure/[email protected]'
with:
version: '${{ matrix.helm-version }}'
token: ${{ secrets.GITHUB_TOKEN }}
- id: 'set-up-python'
name: Install Python (The Chart Testing CLI Depends On It)
uses: 'actions/[email protected]'
with:
python-version: 3.11.4
- id: 'set-up-chart-testing'
name: Install Chart Testing CLI
uses: 'helm/[email protected]'
with:
version: 'v3.8.0'
- id: 'list-changed'
name: Check If The Chart Has Changes
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Get Changed Test Relevant Files
id: 'list-changed-test'
uses: tj-actions/changed-files@v42
with:
files: |
go.mod
go.sum
charts/zitadel/acceptance/**
- id: 'add-cockroachdb-repo'
name: Add The CockroachDB Helm Repo
run: 'helm repo add cockroachdb https://charts.cockroachdb.com/'
if: steps.list-changed.outputs.changed == 'true' || steps.list-changed-test.outputs.any_changed == 'true'
- id: 'lint'
name: Lint The Chart
run: 'ct lint --target-branch ${{ github.event.repository.default_branch }}'
if: steps.list-changed.outputs.changed == 'true' || steps.list-changed-test.outputs.any_changed == 'true'
- id: 'create-kind'
name: Create Kubernetes Cluster with KinD
uses: 'helm/[email protected]'
if: steps.list-changed.outputs.changed == 'true' || steps.list-changed-test.outputs.any_changed == 'true'
with:
node_image: 'kindest/node:${{ matrix.k8s.kindest-image-tag }}'
version: 'v0.20.0'
- id: 'setup-go'
uses: actions/setup-go@v5
with:
go-version: '1.21.4'
- id: 'test'
name: Run Go Tests
run: 'go test -p 1 ./...'
if: steps.list-changed.outputs.changed == 'true' || steps.list-changed-test.outputs.any_changed == 'true'
- id: 'zitadel-test-namespaces'
name: Grep Created Namespaces
run: |
echo "pgInsecure=$(kubectl get namespaces --output name | grep 1-postgres-insecure | cut -d / -f 2)" >> "$GITHUB_OUTPUT"
echo "pgSecure=$(kubectl get namespaces --output name | grep 2-postgres-secure | cut -d / -f 2)" >> "$GITHUB_OUTPUT"
echo "crInsecure=$(kubectl get namespaces --output name | grep 3-cockroach-insecure | cut -d / -f 2)" >> "$GITHUB_OUTPUT"
echo "crSecure=$(kubectl get namespaces --output name | grep 4-cockroach-secure | cut -d / -f 2)" >> "$GITHUB_OUTPUT"
echo "refSecrets=$(kubectl get namespaces --output name | grep 5-referenced-secrets | cut -d / -f 2)" >> "$GITHUB_OUTPUT"
echo "machineUser=$(kubectl get namespaces --output name | grep 6-machine-user | cut -d / -f 2)" >> "$GITHUB_OUTPUT"
echo "selfSigned=$(kubectl get namespaces --output name | grep 7-self-signed | cut -d / -f 2)" >> "$GITHUB_OUTPUT"
if: always()
- id: 'namespace-report-pg-insecure'
name: Show ${{ steps.zitadel-test-namespaces.outputs.pgInsecure }} Namespace
uses: jupyterhub/action-k8s-namespace-report@v1
if: always()
with:
namespace: ${{ steps.zitadel-test-namespaces.outputs.pgInsecure }}
- id: 'namespace-report-pg-secure'
name: Show ${{ steps.zitadel-test-namespaces.outputs.pgSecure }} Namespace
uses: jupyterhub/action-k8s-namespace-report@v1
if: always()
with:
namespace: ${{ steps.zitadel-test-namespaces.outputs.pgSecure }}
- id: 'namespace-report-cr-insecure'
name: Show ${{ steps.zitadel-test-namespaces.outputs.crInsecure }} Namespace
uses: jupyterhub/action-k8s-namespace-report@v1
if: always()
with:
namespace: ${{ steps.zitadel-test-namespaces.outputs.crInsecure }}
- id: 'namespace-report-cr-secure'
name: Show ${{ steps.zitadel-test-namespaces.outputs.crSecure }} Namespace
uses: jupyterhub/action-k8s-namespace-report@v1
if: always()
with:
namespace: ${{ steps.zitadel-test-namespaces.outputs.crSecure }}
- id: 'namespace-report-ref-secrets'
name: Show ${{ steps.zitadel-test-namespaces.outputs.refSecrets }} Namespace
uses: jupyterhub/action-k8s-namespace-report@v1
if: always()
with:
namespace: ${{ steps.zitadel-test-namespaces.outputs.refSecrets }}
- id: 'namespace-report-machine-user'
name: Show ${{ steps.zitadel-test-namespaces.outputs.machineUser }} Namespace
uses: jupyterhub/action-k8s-namespace-report@v1
if: always()
with:
namespace: ${{ steps.zitadel-test-namespaces.outputs.machineUser }}
- id: 'namespace-report-self-signed'
name: Show ${{ steps.zitadel-test-namespaces.outputs.selfSigned }} Namespace
uses: jupyterhub/action-k8s-namespace-report@v1
if: always()
with:
namespace: ${{ steps.zitadel-test-namespaces.outputs.selfSigned }}