Skip to content

Commit c2cb286

Browse files
authored
Export the k8s logs of graphscope helm test and upload to artifact when the helm test failed (#2683)
Signed-off-by: Ye Cao <[email protected]>
1 parent 81230c5 commit c2cb286

File tree

2 files changed

+99
-4
lines changed

2 files changed

+99
-4
lines changed

.github/workflows/gss.yml

+42-3
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ jobs:
113113
runs-on: [self-hosted, ubuntu2004]
114114
if: ${{ github.repository == 'alibaba/GraphScope' }}
115115
needs: [gremlin-test]
116+
environment:
117+
JAVA_HOME: /usr/lib/jvm/default-java
118+
GS_TEST_DIR: ${{ github.workspace }}/gstest
116119
steps:
117120
- uses: actions/checkout@v3
118121
with:
@@ -149,9 +152,6 @@ jobs:
149152
sudo /etc/init.d/ssh start
150153
151154
- name: Python Test with Helm Deployment
152-
env:
153-
JAVA_HOME: /usr/lib/jvm/default-java
154-
GS_TEST_DIR: ${{ github.workspace }}/gstest
155155
run: |
156156
# groot.tar.gz is needed for offline_load.sh
157157
# see .github/workflows/hadoop_scripts/offline_load.sh.template
@@ -173,7 +173,26 @@ jobs:
173173
cd ${GITHUB_WORKSPACE}/charts
174174
helm install ci --set image.tag=${SHORT_SHA} ./graphscope-store
175175
helm test ci --timeout 5m0s
176+
mkdir -p ${{ github.workspace }}/helm-deployment-logs
176177
178+
- name: Export kubernetes logs
179+
uses: dashanji/kubernetes-log-export-action@v3
180+
if: ${{ failure() }}
181+
env:
182+
SHOW_TIMESTAMPS: 'true'
183+
OUTPUT_DIR: ${{ github.workspace }}/helm-deployment-logs
184+
# use wildcard here to match the namespaces that you want to export logs
185+
NAMESPACES: default
186+
187+
- name: upload the k8s logs to artifact
188+
uses: actions/upload-artifact@v2
189+
if: ${{ failure() }}
190+
with:
191+
name: helm-deployment-logs
192+
path: ${{ github.workspace }}/helm-deployment-logs
193+
194+
- name: Test the helm deployment
195+
run: |
177196
# 1. get gss service endpoint
178197
export GRPC_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services ci-graphscope-store-frontend)
179198
export GREMLIN_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[1].nodePort}" services ci-graphscope-store-frontend)
@@ -207,6 +226,26 @@ jobs:
207226
sleep 30
208227
cd ${GITHUB_WORKSPACE}/charts
209228
helm install ci --set image.tag=${SHORT_SHA} ./graphscope-store
229+
mkdir -p ${{ github.workspace }}/helm-deployment-with-pv-logs
230+
231+
- name: Export kubernetes logs
232+
uses: dashanji/kubernetes-log-export-action@v3
233+
if: ${{ failure() }}
234+
env:
235+
SHOW_TIMESTAMPS: 'true'
236+
OUTPUT_DIR: ${{ github.workspace }}/helm-deployment-logs
237+
# use wildcard here to match the namespaces that you want to export logs
238+
NAMESPACES: default
239+
240+
- name: upload the k8s logs to artifact
241+
uses: actions/upload-artifact@v2
242+
if: ${{ failure() }}
243+
with:
244+
name: helm-deployment-logs
245+
path: ${{ github.workspace }}/helm-deployment-logs
246+
247+
- name: Python Test with Helm Deployment and PersistentVolume
248+
run: |
210249
# helm test and python test on the restarted store
211250
export GRPC_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services ci-graphscope-store-frontend)
212251
export GREMLIN_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[1].nodePort}" services ci-graphscope-store-frontend)

.github/workflows/k8s-ci.yml

+57-1
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ jobs:
426426
minikube image load graphscope/learning:${SHORT_SHA}
427427
echo "loaded learning"
428428
429-
- name: Helm Test
429+
- name: Helm Test of installation
430430
env:
431431
GS_TEST_DIR: ${{ github.workspace }}/gstest
432432
run: |
@@ -436,12 +436,51 @@ jobs:
436436
helm install graphscope --set image.registry="",image.tag="${SHORT_SHA}",withJupyter=false,volumes.enabled=true,volumes.items.data.field.path=${GS_TEST_DIR},engines.log_level=DEBUG \
437437
./graphscope
438438
helm test graphscope --timeout 5m0s
439+
mkdir -p ${{ github.workspace }}/helm-installation-logs
440+
441+
- name: Export kubernetes logs
442+
uses: dashanji/kubernetes-log-export-action@v3
443+
if: ${{ failure() }}
444+
env:
445+
SHOW_TIMESTAMPS: 'true'
446+
OUTPUT_DIR: ${{ github.workspace }}/helm-installation-logs
447+
# use wildcard here to match the namespaces that you want to export logs
448+
NAMESPACES: default
449+
450+
- name: upload the k8s logs to artifact
451+
uses: actions/upload-artifact@v2
452+
if: ${{ failure() }}
453+
with:
454+
name: helm-installation-logs
455+
path: ${{ github.workspace }}/helm-installation-logs
456+
457+
- name: Helm Test with pytest
458+
run: |
439459
export NODE_IP=$(kubectl get pod -lgraphscope.coordinator.name=coordinator-graphscope -ojsonpath="{.items[0].status.hostIP}")
440460
export NODE_PORT=$(kubectl get services coordinator-service-graphscope -ojsonpath="{.spec.ports[0].nodePort}")
441461
echo "GraphScope service listen on ${NODE_IP}:${NODE_PORT}"
442462
export GS_ADDR=${NODE_IP}:${NODE_PORT}
443463
cd ${GITHUB_WORKSPACE}/python
444464
python3 -m pytest -s -vvv ./graphscope/tests/kubernetes/test_demo_script.py -k test_helm_installation
465+
mkdir -p ${{ github.workspace }}/helm-pytest-logs
466+
467+
- name: Export kubernetes logs
468+
uses: dashanji/kubernetes-log-export-action@v3
469+
if: ${{ failure() }}
470+
env:
471+
SHOW_TIMESTAMPS: 'true'
472+
OUTPUT_DIR: ${{ github.workspace }}/helm-pytest-logs
473+
NAMESPACES: default
474+
475+
- name: upload the k8s logs to artifact
476+
uses: actions/upload-artifact@v2
477+
if: ${{ failure() }}
478+
with:
479+
name: helm-pytest-logs
480+
path: ${{ github.workspace }}/helm-pytest-logs
481+
482+
- name: Delete Helm Cluster
483+
run: |
445484
helm delete graphscope
446485
447486
- name: Kubernetes Test
@@ -664,3 +703,20 @@ jobs:
664703
--set frontend.service.type=NodePort
665704
# run failover test
666705
cd ${GITHUB_WORKSPACE}/interactive_engine/compiler && ./ir_k8s_failover_ci.sh default test-gie-standalone 2 1
706+
mkdir -p ${{ github.workspace }}/k8s-failover-logs
707+
708+
- name: Export kubernetes logs
709+
uses: dashanji/kubernetes-log-export-action@v3
710+
if: ${{ failure() }}
711+
env:
712+
SHOW_TIMESTAMPS: 'true'
713+
OUTPUT_DIR: ${{ github.workspace }}/k8s-failover-logs
714+
# use wildcard here to match the namespaces that you want to export logs
715+
NAMESPACES: default
716+
717+
- name: upload the k8s logs to artifact
718+
uses: actions/upload-artifact@v2
719+
if: ${{ failure() }}
720+
with:
721+
name: k8s-failover-logs
722+
path: ${{ github.workspace }}/k8s-failover-logs

0 commit comments

Comments
 (0)