-
Notifications
You must be signed in to change notification settings - Fork 109
161 lines (149 loc) · 8.31 KB
/
helm-integration-test-backend.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
name: Helm Integration Test Reusable (backend)
on:
workflow_call:
inputs:
component:
required: true
type: string
target:
required: true
type: string
jobs:
helm-integration-test:
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- name: Setup environment
run: |
sudo kill -9 `sudo lsof -t -i:8084`
sudo lsof -i -P -n | grep LISTEN
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
overprovision-lvm: "true"
remove-dotnet: "true"
build-mount-path: "/var/lib/docker/"
- name: Setup Minikube
run: |
sudo service docker restart
minikube start --cpus 3 --memory 8192
- name: Checkout repo and load .env
uses: actions/checkout@v4
with:
repository: instill-ai/instill-core
- name: Load .env file
uses: cardinalby/export-env-action@v2
with:
envFile: .env
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GOLANG_VERSION }}
- name: Install k6
run: |
go install go.k6.io/xk6/cmd/xk6@v${{ env.XK6_VERSION }}
xk6 build v${{ env.K6_VERSION }} \
--with github.com/grafana/xk6-sql@v${{ env.XK6_SQL_VERSION }} \
--with github.com/grafana/xk6-sql-driver-postgres@v${{ env.XK6_SQL_POSTGRES_VERSION }} && \
sudo cp k6 /usr/bin
- name: Launch Helm Instill Core (${{ inputs.target }})
# Dummy GitHub OAuth configuration variables are inserted on
# `pipeline-backend` because tests in this service rely on the
# integration to be configured.
run: |
if [ "${{ inputs.target }}" == "latest" ]; then
helm install core charts/core --namespace instill-ai --create-namespace \
--set edition=k8s-ce:test \
--set artifactBackend.image.tag=latest \
--set apiGateway.image.tag=latest \
--set mgmtBackend.image.tag=latest \
--set pipelineBackend.image.tag=latest \
--set 'pipelineBackend.extraEnv[0].name=CFG_COMPONENT_SECRETS_GITHUB_OAUTHCLIENTID' \
--set 'pipelineBackend.extraEnv[0].value=dummy' \
--set 'pipelineBackend.extraEnv[1].name=CFG_COMPONENT_SECRETS_GITHUB_OAUTHCLIENTSECRET' \
--set 'pipelineBackend.extraEnv[1].value=dummy' \
--set modelBackend.image.tag=latest \
--set console.image.tag=latest \
--set rayService.image.tag=latest \
--set rayService.headGroupSpec.resources.limits.cpu=0 \
--set rayService.headGroupSpec.resources.limits.memory=2Gi \
--set rayService.headGroupSpec.resources.requests.cpu=0 \
--set rayService.headGroupSpec.resources.requests.memory=2Gi \
--set rayService.workerGroupSpecs[0].replicas=1 \
--set rayService.workerGroupSpecs[0].minReplicas=1 \
--set rayService.workerGroupSpecs[0].maxReplicas=1 \
--set rayService.workerGroupSpecs[0].groupName=test-group \
--set rayService.workerGroupSpecs[0].gpuWorkerGroup.enabled=false \
--set rayService.workerGroupSpecs[0].resources.limits.cpu=1 \
--set rayService.workerGroupSpecs[0].resources.limits.memory=2Gi \
--set rayService.workerGroupSpecs[0].resources.requests.cpu=1 \
--set rayService.workerGroupSpecs[0].resources.requests.memory=2Gi \
--set milvus.broker.resources.requests.cpu=0.25 \
--set milvus.autorecovery.resources.requests.cpu=0.25 \
--set milvus.proxy.resources.requests.cpu=0.25 \
--set tags.observability=false \
--set tags.prometheusStack=false
else
helm install core charts/core --namespace instill-ai --create-namespace \
--set edition=k8s-ce:test \
--set artifactBackend.image.tag=${ARTIFACT_BACKEND_VERSION} \
--set apiGateway.image.tag=${API_GATEWAY_VERSION} \
--set mgmtBackend.image.tag=${MGMT_BACKEND_VERSION} \
--set mgmtBackend.instillCoreHost=http://${INSTILL_CORE_HOST}:${API_GATEWAY_PORT} \
--set pipelineBackend.image.tag=${PIPELINE_BACKEND_VERSION} \
--set pipelineBackend.instillCoreHost=http://${INSTILL_CORE_HOST}:${API_GATEWAY_PORT} \
--set 'pipelineBackend.extraEnv[0].name=CFG_COMPONENT_SECRETS_GITHUB_OAUTHCLIENTID' \
--set 'pipelineBackend.extraEnv[0].value=dummy' \
--set 'pipelineBackend.extraEnv[1].name=CFG_COMPONENT_SECRETS_GITHUB_OAUTHCLIENTSECRET' \
--set 'pipelineBackend.extraEnv[1].value=dummy' \
--set modelBackend.instillCoreHost=http://${INSTILL_CORE_HOST}:${API_GATEWAY_PORT} \
--set modelBackend.image.tag=${MODEL_BACKEND_VERSION} \
--set console.image.tag=${CONSOLE_VERSION} \
--set rayService.image.tag=${RAY_SERVER_VERSION} \
--set rayService.headGroupSpec.resources.limits.cpu=0 \
--set rayService.headGroupSpec.resources.limits.memory=2Gi \
--set rayService.headGroupSpec.resources.requests.cpu=0 \
--set rayService.headGroupSpec.resources.requests.memory=2Gi \
--set rayService.workerGroupSpecs[0].replicas=1 \
--set rayService.workerGroupSpecs[0].minReplicas=1 \
--set rayService.workerGroupSpecs[0].maxReplicas=1 \
--set rayService.workerGroupSpecs[0].groupName=test-group \
--set rayService.workerGroupSpecs[0].gpuWorkerGroup.enabled=false \
--set rayService.workerGroupSpecs[0].resources.limits.cpu=1 \
--set rayService.workerGroupSpecs[0].resources.limits.memory=2Gi \
--set rayService.workerGroupSpecs[0].resources.requests.cpu=1 \
--set rayService.workerGroupSpecs[0].resources.requests.memory=2Gi \
--set milvus.broker.resources.requests.cpu=0.25 \
--set milvus.autorecovery.resources.requests.cpu=0.25 \
--set milvus.proxy.resources.requests.cpu=0.25 \
--set tags.observability=false \
--set tags.prometheusStack=false
fi
- name: Wait for all pods up
run: |
while [[ $(kubectl get pods --namespace instill-ai -l "app.kubernetes.io/component=api-gateway,app.kubernetes.io/instance=core" -o 'jsonpath={..status.phase}') != *"Running"* ]]; do
echo "$(kubectl get pods --namespace instill-ai)"
sleep 10
done
while [[ $(kubectl get pods --namespace instill-ai -l "app.kubernetes.io/component=model-backend,app.kubernetes.io/instance=core" -o 'jsonpath={..status.phase}') != *"Running"* ]]; do
echo "$(kubectl get pods --namespace instill-ai)"
sleep 10
done
echo "$(kubectl get pods --namespace instill-ai)"
- name: Port-forward of api-gateway
run: |
API_GATEWAY_POD_NAME=$(kubectl get pods --namespace instill-ai -l "app.kubernetes.io/component=api-gateway,app.kubernetes.io/instance=core" -o json | jq -r '.items[0].metadata.name')
kubectl --namespace instill-ai port-forward ${API_GATEWAY_POD_NAME} ${API_GATEWAY_PORT}:${API_GATEWAY_PORT} > /dev/null 2>&1 &
DATABASE_POD_NAME=$(kubectl get pods --namespace instill-ai -l "app.kubernetes.io/component=database,app.kubernetes.io/instance=core" -o json | jq -r '.items[0].metadata.name')
kubectl --namespace instill-ai port-forward ${DATABASE_POD_NAME} ${POSTGRESQL_PORT}:${POSTGRESQL_PORT} > /dev/null 2>&1 &
while ! nc -vz localhost ${API_GATEWAY_PORT} > /dev/null 2>&1; do sleep 5; done
- name: Run ${{ inputs.component }} integration test (${{ inputs.target }})
env:
COMPONENT_VERSION: ${{ env[format('{0}_VERSION', steps.uppercase.outputs.COMPONENT_NAME)] }}
run: |
if [ "${{ inputs.target }}" == "latest" ]; then
git clone https://github.com/instill-ai/${{ inputs.component }}.git
else
git clone -b v$COMPONENT_VERSION https://github.com/instill-ai/${{ inputs.component }}.git
fi
cd ${{ inputs.component }}
make integration-test API_GATEWAY_URL=localhost:${API_GATEWAY_PORT} DB_HOST=localhost