forked from OpenFunction/OpenFunction
-
Notifications
You must be signed in to change notification settings - Fork 0
212 lines (186 loc) · 6.71 KB
/
main.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
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
#
# Copyright 2022 The OpenFunction Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Main CI WorkFlow
on:
pull_request:
branches:
- 'main'
- 'release-*'
paths:
- '.github/workflows/**'
- 'apis/**'
- 'config/bundle.yaml'
- 'config/samples/function-bindings-sample-serving-only.yaml'
- 'config/samples/function-pubsub-sample-serving-only.yaml'
- 'config/samples/function-knative-with-dapr-serving-only.yaml'
- 'config/samples/function-sample-serving-only.yaml'
- 'config/samples/function-with-plugins-serving-only.yaml'
- 'controllers/**'
- 'hack/generate-cert.sh'
- 'pkg/**'
- 'Dockerfile'
- 'main.go'
- 'Makefile'
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 30
name: Verify and Unit Test
env:
GO111MODULE: "on"
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: 1.19
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check License Header
uses: apache/skywalking-eyes/header@501a28d2fb4a9b962661987e50cf0219631b32ff
- name: Install kubebuilder-3.11.1
run: |
curl -L -o kubebuilder "https://github.com/kubernetes-sigs/kubebuilder/releases/download/v3.11.1/kubebuilder_linux_amd64"
chmod +x kubebuilder && mv kubebuilder /usr/local/bin/
- name: Run basic test
run: make test
- name: Run verify crds test
run: make verify
e2e_test:
runs-on: ubuntu-latest
timeout-minutes: 60
name: E2E Tests
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: 1.19
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create kind cluster
uses: container-tools/kind-action@v1
with:
version: v0.20.0
node_image: kindest/node:v1.26.6
- name: Create busybox pod
run: |
kubectl apply -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
name: curl
spec:
containers:
- name: curl
image: radial/busyboxplus:curl
command:
- sh
- -c
- while true; do sleep 1; done
EOF
- name: Install dependent components
run: |
# Install kafka
helm repo add strimzi https://strimzi.io/charts/
helm install kafka-operator -n default strimzi/strimzi-kafka-operator
kubectl apply -f config/samples/function-kafka-quick.yaml
# Install nats and stan
helm repo add nats https://nats-io.github.io/k8s/helm/charts/
helm install nats nats/nats
helm install stan nats/stan --set stan.nats.url=nats://nats:4222
- name: Build and Push image
run: |
docker build . -t kind-registry:5000/openfunction/openfunction:latest -f Dockerfile --build-arg GOPROXY="https://proxy.golang.org"
docker push kind-registry:5000/openfunction/openfunction:latest
- name: Install OpenFunction
run: |
# Install CRDs
make install
kubectl apply -f https://openfunction.sh1a.qingstor.com/crds/gateway-api-v0.8.0.yaml
# Install OpenFunction Chart
helm repo add openfunction https://openfunction.github.io/charts/
helm repo update
helm install openfunction openfunction/openfunction -n openfunction --create-namespace --devel -f "${GITHUB_WORKSPACE}"/.github/workflows/values
sleep 60
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v1
- name: Wait for kafka to be ready
run: |
for i in {1..600}
do
status=`kubectl get kafkas.kafka.strimzi.io kafka-server -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}'`
if [ $status == "True" ]; then
echo "The Kafka is ready!"
break
else
sleep 1
continue
fi
done
shell: bash
- name: Knative function e2e test
timeout-minutes: 10
run: |
chmod +x "${GITHUB_WORKSPACE}/.github/workflows/e2e-test.sh"
bash "${GITHUB_WORKSPACE}"/.github/workflows/e2e-test.sh knative
- name: Knative function with Dapr e2e test
timeout-minutes: 10
run: |
bash "${GITHUB_WORKSPACE}"/.github/workflows/e2e-test.sh knative_dapr
- name: Async pubsub function e2e test
timeout-minutes: 10
run: |
bash "${GITHUB_WORKSPACE}"/.github/workflows/e2e-test.sh async_pubsub
- name: Async bindings function e2e test
timeout-minutes: 10
run: |
bash "${GITHUB_WORKSPACE}"/.github/workflows/e2e-test.sh async_bindings
- name: Function with plugins e2e test
timeout-minutes: 10
run: |
bash "${GITHUB_WORKSPACE}"/.github/workflows/e2e-test.sh plugin
- name: Function with events e2e test
timeout-minutes: 10
run: |
# deploy the eventbus backend nats streaming
while /bin/true; do
nats_status=`kubectl get pod nats-0 -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}'`
stan_status=`kubectl get pod stan-0 -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}'`
if [[ "$nats_status" == "True" ]] && [[ "$stan_status" == "True" ]]; then
echo "Nats streaming is ready!"
break
else
sleep 1
continue
fi
done
bash "${GITHUB_WORKSPACE}"/.github/workflows/e2e-test.sh events
- name: Output debug info
if: ${{ failure() }}
run: |
chmod +x "${GITHUB_WORKSPACE}/.github/workflows/output.sh"
bash "${GITHUB_WORKSPACE}"/.github/workflows/output.sh