Repository navigation
192 lines (186 loc) · 8.04 KB
/
Copy pathtest-install.yaml
File metadata and controls
192 lines (186 loc) · 8.04 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
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
name: Install
on:
pull_request:
paths:
- charts/**
- hack/**
- Makefile
- .github/workflows/test-install.yaml
push:
branches: [main]
paths:
- charts/**
- hack/**
- Makefile
- .github/workflows/test-install.yaml
permissions:
contents: read
env:
GATEWAY_API_VERSION: v1.6.2
TRAEFIK_CHART_VERSION: 41.6.1
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# Superseded pull request runs are cancelled; every push to main runs to the end.
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
install:
name: ${{ matrix.scenario }} (k8s ${{ matrix.kubernetes }})${{ matrix.upgrade-from && format(' upgrade from chart {0}', matrix.upgrade-from) || '' }}
runs-on: >-
${{ (github.event_name != 'pull_request'
|| github.event.pull_request.head.repo.full_name == github.repository)
&& format('gcrunner={0}-install-{1}/machine=c3d-standard-4', github.run_id, strategy.job-index)
|| 'ubuntu-latest' }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
# Oldest and newest supported Kubernetes for the default install.
- scenario: default
kubernetes: v1.29.14
- scenario: default
kubernetes: v1.37.0
# NetworkPolicies on, egress restricted. kindnet enforces policies.
- scenario: hardened
kubernetes: v1.37.0
- scenario: separate-workers
kubernetes: v1.37.0
- scenario: grouped-workers
kubernetes: v1.37.0
# Install a published chart release with its own defaults and
# Appwrite version, then upgrade to this chart's: the chart upgrade
# and Appwrite's data migration.
- scenario: default
kubernetes: v1.37.0
upgrade-from: 2.1.0
# PostgreSQL, Redis and ClickHouse outside the release.
- scenario: external-dbs
kubernetes: v1.37.0
external-dbs: true
# Routing through Traefik, as an Ingress controller and as a Gateway.
- scenario: ingress
kubernetes: v1.37.0
traefik: true
- scenario: gateway-api
kubernetes: v1.37.0
traefik: true
routes-args: --header-match
steps:
- uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1
with:
version: v4.3.0
- uses: helm/kind-action@06c1ae10762d3b9c1644e7fe69596ae519e015a2 # v1.15.0
with:
cluster_name: appwrite
node_image: kindest/node:${{ matrix.kubernetes }}
config: hack/kind-config.yaml
- name: Answer the runner's search domains in CoreDNS
run: hack/ci-dns.sh appwrite
- name: Install Traefik and the Gateway API CRDs
if: matrix.traefik
run: |
kubectl apply --server-side -f "https://github.com/kubernetes-sigs/gateway-api/releases/download/${GATEWAY_API_VERSION}/standard-install.yaml"
helm upgrade --install traefik traefik --repo https://traefik.github.io/charts --version "${TRAEFIK_CHART_VERSION}" \
-n traefik --create-namespace -f hack/fixtures/traefik-values.yaml --wait --timeout 5m
- name: Install external datastores
if: matrix.external-dbs
run: |
kubectl apply -f hack/fixtures/external-dbs.yaml
hack/fixtures/external-dbs-secrets.sh appwrite
kubectl -n external-dbs rollout status statefulset/postgres --timeout=5m
kubectl -n external-dbs rollout status deployment/redis --timeout=5m
kubectl -n external-dbs rollout status deployment/clickhouse --timeout=5m
- name: Resolve the external datastores from the release namespace
if: matrix.external-dbs
# Same image and resolver (musl) as Appwrite's wait-for-datastores
# init container, so a DNS problem fails here in seconds with details
# instead of as a 15-minute install timeout.
run: |
# shellcheck disable=SC2016 # expanded inside the pod
kubectl -n appwrite run dns-check --rm -i --restart=Never --image=docker.io/appwrite/appwrite:2.6.2 --command -- sh -c '
cat /etc/resolv.conf
ok=0
for host in postgres.external-dbs.svc.cluster.local postgres.external-dbs.svc postgres.external-dbs; do
if getent hosts "$host"; then echo "resolved $host"; else echo "FAILED $host"; ok=1; fi
done
exit $ok'
- name: Install chart ${{ matrix.upgrade-from }}
if: matrix.upgrade-from
env:
SCENARIO: ${{ matrix.scenario }}
UPGRADE_FROM: ${{ matrix.upgrade-from }}
run: |
helm upgrade --install appwrite oci://ghcr.io/appwrite/charts/appwrite --version "${UPGRADE_FROM}" \
-n appwrite --create-namespace -f "charts/appwrite/ci/${SCENARIO}-values.yaml" --wait --timeout 15m
make smoke
- name: Install
env:
SCENARIO: ${{ matrix.scenario }}
run: make install VALUES="charts/appwrite/ci/${SCENARIO}-values.yaml"
- name: Check the API runs the new version (the migration hook must succeed for the upgrade to pass)
if: matrix.upgrade-from
run: |
kubectl -n appwrite get deployment appwrite-api -o jsonpath='{.metadata.annotations.appwrite/version}' | grep -qx "$(awk '/^appVersion:/ {gsub(/"/, "", $2); print $2}' charts/appwrite/Chart.yaml)"
- name: helm test
run: make helm-test
- name: Smoke test
run: make smoke
- name: Routes
if: matrix.traefik
env:
ROUTES_ARGS: ${{ matrix.routes-args }}
run: |
# shellcheck disable=SC2086 # zero or more flags
hack/routes.sh appwrite.ci.local traefik traefik ${ROUTES_ARGS}
- name: Upgrade without changes keeps credentials and pods
env:
SCENARIO: ${{ matrix.scenario }}
run: |
before=$(kubectl -n appwrite get secret appwrite -o jsonpath='{.data._APP_OPENSSL_KEY_V1}')
pods=$(kubectl -n appwrite get pods -o name | sort)
make install VALUES="charts/appwrite/ci/${SCENARIO}-values.yaml"
after=$(kubectl -n appwrite get secret appwrite -o jsonpath='{.data._APP_OPENSSL_KEY_V1}')
test "$before" = "$after"
test "$pods" = "$(kubectl -n appwrite get pods -o name | sort)"
- name: Diagnostics
if: failure()
run: |
echo "::group::DNS"
kubectl -n kube-system get pods,svc -o wide || true
kubectl -n kube-system get configmap coredns -o jsonpath='{.data.Corefile}' || true
kubectl -n kube-system logs -l k8s-app=kube-dns --tail=100 || true
echo "::endgroup::"
kubectl -n appwrite get all,pvc,events -o wide || true
for pod in $(kubectl -n appwrite get pods -o name); do
echo "::group::$pod"
kubectl -n appwrite describe "$pod" || true
kubectl -n appwrite logs "$pod" --all-containers --tail=200 || true
echo "::endgroup::"
done
# One check to require in branch protection instead of every matrix leg.
result:
name: Install result
needs: install
if: always()
runs-on: >-
${{ (github.event_name != 'pull_request'
|| github.event.pull_request.head.repo.full_name == github.repository)
&& format('gcrunner={0}-result-{1}/machine=c3d-standard-4', github.run_id, strategy.job-index)
|| 'ubuntu-latest' }}
permissions: {}
steps:
- uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
with:
egress-policy: audit
- name: Every install passed
env:
RESULT: ${{ needs.install.result }}
run: |
echo "install matrix: ${RESULT}"
[[ "$RESULT" == success ]]