forked from apache/linkis
-
Notifications
You must be signed in to change notification settings - Fork 8
186 lines (165 loc) · 7.15 KB
/
integration-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
177
178
179
180
181
182
183
184
185
186
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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: Integration Test
on:
push:
branches: [master,dev-*]
pull_request:
branches: [master,dev-*]
#concurrency:
# group: test-${{ github.head_ref || github.run_id }}
# cancel-in-progress: true
env:
KIND_CONFIG_PATH: './linkis-dist/helm/scripts/resources/kind-cluster.yaml'
KIND_CLUSTER_NAME: 'test-helm'
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120
jobs:
integration-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.0.0]
kubernetes-version:
# - 'kindest/node:v1.21.10'
- 'kindest/node:v1.23.4'
timeout-minutes: 90
env:
TAG: ${{ github.sha }}
SKIP_TEST: true
HUB: ghcr.io/apache/linkis
LINKIS_VERSION: 1.5.0-SNAPSHOT
steps:
- name: Free up disk space
run: |
# https://github.com/actions/runner-images/issues/2840#issuecomment-790492173
# du -sh /* 2> /dev/null | sort -rh 2> /dev/null | head
# du -h -d2 /usr 2> /dev/null | sort -rh 2> /dev/null | head
echo $JAVA_HOME
echo "Check free disk space before cleanup."
df -h
echo "Removing non-essential tools and libraries."
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf /opt/ghc
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/share/boost
# delete libraries for Android (12G), PowerShell (1.3G), Swift (1.7G)
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/local/share/powershell
sudo rm -rf /usr/share/swift
echo "Check free disk space after cleanup."
df -h
echo $JAVA_HOME
- name: Prune docker images
run: |
echo "Pruning docker images on GH action runner node"
docker image prune -a -f
docker system df
df -h
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: true
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 8
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build frontend by node.js
run: |
cd linkis-web
sed -i "/VUE_APP_MN_CONFIG_PREFIX/d" .env
npm install
npm run build
- name: Build backend by maven
run: |
./mvnw install -Pdocker -Dmysql.connector.scope=compile -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -Dlinkis.build.web=true -Dlinkis.build.ldh=true
- name: Set up chart-testing
uses: ./.github/actions/chart-testing-action
- name: Create Kind cluster
uses: ./.github/actions/kind-action
with:
config: ${{ env.KIND_CONFIG_PATH }}
node_image: ${{ matrix.kubernetes-version }}
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
- name: Start Linkis Service
run: |
docker tag linkis:${{ env.LINKIS_VERSION }} linkis:dev
docker tag linkis-web:${{ env.LINKIS_VERSION }} linkis-web:dev
docker tag linkis-ldh:${{ env.LINKIS_VERSION }} linkis-ldh:dev
# for debug Download the image directly first, then adjust it to active build
#ROOT_DIR=./linkis-dist/
#MIRRORS="ghcr.io"
#TAG="dev"
#docker pull ${MIRRORS}/apache/linkis/linkis-ldh:${TAG}
#docker pull ${MIRRORS}/apache/linkis/linkis:${TAG}
#docker pull ${MIRRORS}/apache/linkis/linkis-web:${TAG}
#docker tag ${MIRRORS}/apache/linkis/linkis:${TAG} linkis:dev
#docker tag ${MIRRORS}/apache/linkis/linkis-web:${TAG} linkis-web:dev
#docker tag ${MIRRORS}/apache/linkis/linkis-ldh:${TAG} linkis-ldh:dev
#show image list
docker image ls
bash ./linkis-dist/helm/scripts/install-mysql.sh false\
&& bash ./linkis-dist/helm/scripts/install-ldh.sh true \
&& bash ./linkis-dist/helm/scripts/install-charts-with-ldh.sh linkis linkis-demo true
n=0
sleep 60
while (($n<10))
do
kubectl get pods -A
n=$((n+1))
sleep 20
done
#show linkis pod logs
#POD_NAME=`kubectl get pods -n linkis -l app.kubernetes.io/instance=linkis-demo-cg-linkismanager -o jsonpath='{.items[0].metadata.name}'`
#kubectl logs -n linkis ${POD_NAME} -f --tail=10000
#POD_NAME=`kubectl get pods -n linkis -l app.kubernetes.io/instance=linkis-demo-cg-engineconnmanager -o jsonpath='{.items[0].metadata.name}'`
#kubectl logs -n linkis ${POD_NAME} -f --tail=10000
shell: bash
- name: Linkis-Cli Test
run: |
# Enable port-forward
bash ./linkis-dist/helm/scripts/remote-proxy.sh start
# Show port-forward list
bash ./linkis-dist/helm/scripts/remote-proxy.sh list
# Check if the web service is available
curl http://127.0.0.1:8088/indexhtml
# Execute test by linkis-cli
POD_NAME=`kubectl get pods -n linkis -l app.kubernetes.io/instance=linkis-demo-mg-gateway -o jsonpath='{.items[0].metadata.name}'`
kubectl exec -it -n linkis ${POD_NAME} -- bash -c " \
sh /opt/linkis/bin/linkis-cli -engineType shell-1 -codeType shell -code \"pwd\" ";
kubectl exec -it -n linkis ${POD_NAME} -- bash -c " \
sh /opt/linkis/bin/linkis-cli -engineType python-python2 -codeType python -code 'print(\"hello\")' "
#todo
#kubectl exec -it -n linkis ${POD_NAME} -- bash -c " \
#sh /opt/linkis/bin/linkis-cli -engineType hive-3.1.3 -codeType hql -code 'show databases' "
#kubectl exec -it -n linkis ${POD_NAME} -- bash -c " \
#sh /opt/linkis/bin/linkis-cli -engineType spark-3.2.1 -codeType sql -code 'show databases' "
shell: bash