Skip to content

Commit f9ba951

Browse files
author
diverdane
committed
Adding debug dump for GitHub actions test failures
1 parent b8d67dd commit f9ba951

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

test.sh

+28-1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,26 @@ fi
7474
DATABASE_USER="postgres"
7575
DATABASE_PASSWORD="postgres-password"
7676

77+
function dump_debug_info() {
78+
announce "Showing summary of Kubernetes objects in $CONJUR_NAMESPACE namespace"
79+
kubectl get all -n "$CONJUR_NAMESPACE"
80+
81+
announce "Showing Conjur OSS Server logs"
82+
kubectl logs -l "app=conjur-oss" -c conjur-oss
83+
84+
announce "Showing Conjur OSS NGINX logs"
85+
kubectl logs -l "app=conjur-oss" -c "$RELEASE_NAME"-nginx
86+
87+
announce "Showing Postgres logs"
88+
kubectl logs -l "app=conjur-oss-postgres"
89+
90+
announce "Showing Kubernetes nodes"
91+
kubectl describe nodes
92+
93+
announce "Showing details of Kubernetes objects in $CONJUR_NAMESPACE namespace"
94+
kubectl get all -n "$CONJUR_NAMESPACE" -o yaml
95+
}
96+
7797
function delete_release() {
7898
announce "Deleting Conjur Helm release $RELEASE_NAME"
7999
echo "HELM_DEL_ARGS: $HELM_DEL_ARGS"
@@ -89,6 +109,11 @@ function delete_release() {
89109
fi
90110
}
91111

112+
function dump_debug_and_delete_release() {
113+
dump_debug_info
114+
delete_release
115+
}
116+
92117
announce "Installing Conjur OSS, waiting until server is ready..."
93118
data_key="$(docker run --rm cyberark/conjur data-key generate)"
94119
echo "RELEASE_NAME: $RELEASE_NAME"
@@ -102,17 +127,19 @@ echo "HELM_INSTALL_ARGS: $HELM_INSTALL_ARGS"
102127
echo "HELM_INSTALL_TIMEOUT: $HELM_INSTALL_TIMEOUT"
103128
echo "Helm Version: $(helm version)"
104129
echo "Kubernetes Version: $(kubectl version)"
130+
trap dump_debug_info EXIT
105131
helm install --wait \
106132
--timeout $HELM_INSTALL_TIMEOUT \
107133
--set "dataKey=$data_key" \
108134
$HELM_INSTALL_ARGS \
109135
$RELEASE_ARG \
110136
./conjur-oss
111-
trap delete_release EXIT
137+
trap dump_debug_and_delete_release EXIT
112138

113139
announce "Running helm tests"
114140
echo "HELM_TEST_ARGS: $HELM_TEST_ARGS"
115141
helm test $HELM_TEST_ARGS "$RELEASE_NAME"
142+
trap delete_release EXIT
116143

117144
if [[ (! is_helm_v2) && ("$HELM_TEST_LOGGING" == true) ]]; then
118145
# Test pod log has been displayed, so it's safe to delete the test pod.

0 commit comments

Comments
 (0)