diff --git a/.circleci/config.yml b/.circleci/config.yml index 10f88181d8..c0355994be 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -292,11 +292,67 @@ commands: name: "Gather logs" when: always command: | - rsync -ma --include='*/' --include='*.xml' --include='*.tap' --include='*.log' --include='Test*.webm' --exclude='*' . /tmp/test-logs + rsync \ + --prune-empty-dirs --archive --include='*/' \ + --include='*.xml' \ + --include='*.tap' \ + --include='*.log' \ + --include='Test*.webm' \ + --exclude='*' \ + . \ + /tmp/test-logs + if test -d ~/.cache/telepresence/logs; then + rsync \ + --archive \ + ~/.cache/telepresence/logs \ + /tmp/test-logs/telepresence-logs + fi + if test -f docker/container.txt; then + docker exec $(cat docker/container.txt) /bin/bash -c 'mkdir -p /tmp/build-container-logs && (cp -r /tmp/*.txt /tmp/*.json /tmp/*.log /tmp/*.yaml /tmp/build-container-logs || true) && ((test -d ~/.cache/telepresence/logs && cp -r ~/.cache/telepresence/logs /tmp/build-container-logs/telepresence-logs) || true)' + docker cp $(cat docker/container.txt):/tmp/build-container-logs /tmp/test-logs/build-container-logs + fi - store_artifacts: name: "Store logs" path: /tmp/test-logs destination: test-logs + - run: + name: "Gather coverage" + when: always + command: | + mkdir -p /tmp/coverage + if test -f docker/container.txt; then + docker cp $(cat docker/container.txt):/tmp/cov_html /tmp/coverage || true + fi + - store_artifacts: + name: "Store coverage" + path: /tmp/coverage + destination: coverage + - run: + name: "Gather pod logs" + when: always + command: | + if ! test -f ~/.kube/kubeception.yaml ; then + exit 0 + fi + + export KUBECONFIG=~/.kube/kubeception.yaml + podsfile=/tmp/all-pods.txt + (kubectl get pods --all-namespaces -ocustom-columns="name:.metadata.name,namespace:.metadata.namespace" --no-headers || true) > $podsfile + (kubectl describe pods --all-namespaces || true) > /tmp/all-pods-described.txt + + mkdir -p /tmp/pod-logs + cat $podsfile | while IFS= read -r line; do + name=$(echo $line | awk '{print $1}') + ns=$(echo $line | awk '{print $2}') + nsdir=/tmp/pod-logs/${ns}/ + mkdir -p $nsdir + outfile=${nsdir}/${name}-pod.log + (kubectl logs -n $ns $name > $outfile || echo "FAILED, status $ret, continuing...") || true + done + - store_artifacts: + name: "Store pod logs" + path: /tmp/pod-logs + destination: pod-logs website-setup: steps: - install-node: