Skip to content
Snippets Groups Projects
Commit 56b1d9e7 authored by Julien Leduc's avatar Julien Leduc
Browse files

Collecting the logs to tmpdir in case of failure

parent a093a0e8
No related branches found
No related tags found
No related merge requests found
......@@ -27,12 +27,22 @@ if [ ! -z "${error}" ]; then
exit 1
fi
echo "Getting stdout logs of pods"
mkdir -p ../../pod_logs/${instance}
# Collect the logs
###
# First in a temporary directory so that we can get the logs on the gitlab runner if something bad happens
# indeed if the system test fails, artifacts are not collected for the build
tmpdir=$(mktemp -d -t ${instance}_delete_XXXX)
echo "Collecting stdout logs of pods to ${tmpdir}"
for podcontainer in "init -c ctainit" "ctacli -c ctacli" "ctaeos -c mgm" "ctafrontend -c ctafrontend" "kdc -c kdc" "tpsrv -c taped" "tpsrv -c rmcd"; do
kubectl --namespace ${instance} logs ${podcontainer} > ../../pod_logs/${instance}/$(echo ${podcontainer} | sed -e 's/ -c /-/').log
kubectl --namespace ${instance} logs ${podcontainer} > ${tmpdir}/$(echo ${podcontainer} | sed -e 's/ -c /-/').log
done
if [ -z "${CI_PIPELINE_ID}" ]; then
# we are in the context of a CI run => save artifacts in the directory structure of the build
mkdir -p ../../pod_logs/${instance}
cp -r ${tmpdir}/* ../../pod_logs/${instance}
fi
echo "Deleting ${instance} instance"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment