Skip to content

Commit 919ee36

Browse files
Enhance debugging output for failed service boot and test failures in CI workflow
1 parent 56ac1be commit 919ee36

File tree

1 file changed

+72
-6
lines changed

1 file changed

+72
-6
lines changed

.github/workflows/helm-tests.yml

Lines changed: 72 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,40 @@ jobs:
118118
- name: cleanup if services fail to boot
119119
if: steps.watchservices.outcome == 'failure'
120120
run: |
121-
echo "The previous step failed or timed out."
121+
echo "The watchservices step failed or timed out. Extracting pod logs for debugging..."
122+
123+
# Get and display all pods status
124+
echo "===== Pod Status ====="
125+
kubectl get pods
126+
127+
# Extract logs from database pod
128+
echo "===== Database Pod Logs ====="
129+
kubectl get pod | grep "^db-$RELEASE_NAME" | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} --tail=100 || echo "Could not get database logs"
130+
131+
# Extract logs from pgstacbootstrap pod
132+
echo "===== PGSTACBootstrap Pod Logs ====="
133+
kubectl get pod | grep "^pgstacbootstrap-$RELEASE_NAME" | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} --tail=100 || echo "Could not get pgstacbootstrap logs"
134+
135+
# Extract logs from raster pod init container (wait-for-pgstacbootstrap)
136+
echo "===== Raster Pod Init Container Logs (wait-for-pgstacbootstrap) ====="
137+
kubectl get pod | grep "^raster-$RELEASE_NAME" | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} -c wait-for-pgstacbootstrap --tail=100 || echo "Could not get raster init container logs"
138+
139+
# Extract logs from raster pod main container
140+
echo "===== Raster Pod Main Container Logs ====="
141+
kubectl get pod | grep "^raster-$RELEASE_NAME" | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} --tail=100 || echo "Could not get raster main container logs"
142+
143+
# Extract logs from vector pod
144+
echo "===== Vector Pod Logs ====="
145+
kubectl get pod | grep "^vector-$RELEASE_NAME" | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} --tail=100 || echo "Could not get vector logs"
146+
147+
# Extract logs from stac pod
148+
echo "===== STAC Pod Logs ====="
149+
kubectl get pod | grep "^stac-$RELEASE_NAME" | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} --tail=100 || echo "Could not get STAC logs"
150+
151+
# Check if pods are in pending state or have issues
152+
echo "===== Pod Descriptions for Troubleshooting ====="
153+
kubectl get pod | grep "$RELEASE_NAME" | cut -d' ' -f1 | xargs -I{} kubectl describe pod/{} || echo "Could not describe pods"
154+
122155
# force GH action to show failed result
123156
exit 128
124157
@@ -145,18 +178,51 @@ jobs:
145178
echo $RASTER_ENDPOINT
146179
echo '#################################'
147180
148-
pytest .github/workflows/tests/test_vector.py || kubectl logs svc/vector-$RELEASE_NAME
149-
pytest .github/workflows/tests/test_stac.py
181+
pytest .github/workflows/tests/test_vector.py || kubectl logs svc/vector
182+
pytest .github/workflows/tests/test_stac.py || kubectl logs svc/stac
150183
# TODO: fix raster tests
151-
#pytest .github/workflows/tests/test_raster.py
184+
#pytest .github/workflows/tests/test_raster.py || kubectl logs svc/raster
152185
153186
- name: error if tests failed
154187
if: steps.testrunner.outcome == 'failure'
155188
run: |
156-
echo "The previous step failed or timed out."
189+
echo "The tests failed. Extracting pod logs for debugging..."
190+
191+
# Get and display all pods status
192+
echo "===== Pod Status ====="
193+
kubectl get pods
194+
195+
# Extract logs from database pod
196+
echo "===== Database Pod Logs ====="
197+
kubectl get pod | grep "^db-$RELEASE_NAME" | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} --tail=100 || echo "Could not get database logs"
198+
199+
# Extract logs from pgstacbootstrap pod
200+
echo "===== PGSTACBootstrap Pod Logs ====="
201+
kubectl get pod | grep "^pgstacbootstrap-$RELEASE_NAME" | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} --tail=100 || echo "Could not get pgstacbootstrap logs"
202+
203+
# Extract logs from raster pod init container (wait-for-pgstacbootstrap)
204+
echo "===== Raster Pod Init Container Logs (wait-for-pgstacbootstrap) ====="
205+
kubectl get pod | grep "^raster-$RELEASE_NAME" | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} -c wait-for-pgstacbootstrap --tail=100 || echo "Could not get raster init container logs"
206+
207+
# Extract logs from raster pod main container
208+
echo "===== Raster Pod Main Container Logs ====="
209+
kubectl get pod | grep "^raster-$RELEASE_NAME" | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} --tail=100 || echo "Could not get raster main container logs"
210+
211+
# Extract logs from vector pod
212+
echo "===== Vector Pod Logs ====="
213+
kubectl get pod | grep "^vector-$RELEASE_NAME" | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} --tail=100 || echo "Could not get vector logs"
214+
215+
# Extract logs from stac pod
216+
echo "===== STAC Pod Logs ====="
217+
kubectl get pod | grep "^stac-$RELEASE_NAME" | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} --tail=100 || echo "Could not get STAC logs"
218+
219+
# Check if pods are in pending state or have issues
220+
echo "===== Pod Descriptions for Troubleshooting ====="
221+
kubectl get pod | grep "$RELEASE_NAME" | cut -d' ' -f1 | xargs -I{} kubectl describe pod/{} || echo "Could not describe pods"
222+
157223
# force GH action to show failed result
158224
exit 128
159225
160226
- name: helm uninstall eoapi templates
161227
run: |
162-
helm uninstall $RELEASE_NAME
228+
helm uninstall $RELEASE_NAME

0 commit comments

Comments
 (0)