Skip to content

Commit 28ef725

Browse files
committed
Collect PipelineRun artifacts in E2E test failures
1 parent 35720d1 commit 28ef725

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

.github/workflows/test-e2e.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,23 @@ jobs:
7272
run: |
7373
mkdir -p /tmp/k8s-artifacts
7474
kubectl logs -n func-operator-system -l control-plane=controller-manager --tail=-1 --all-containers --prefix --timestamps > /tmp/k8s-artifacts/func-operator.log || true
75-
for resource in functions deployments configmaps; do
75+
for resource in functions deployments configmaps pipelineruns; do
7676
kubectl get ${resource} -A -o yaml > /tmp/k8s-artifacts/${resource}.yaml || true
7777
done
7878
79+
# Install Tekton CLI for better PipelineRun log collection
80+
curl -LO https://github.com/tektoncd/cli/releases/download/v0.44.1/tkn_0.44.1_Linux_x86_64.tar.gz
81+
tar xvzf tkn_0.44.1_Linux_x86_64.tar.gz -C /tmp
82+
chmod +x /tmp/tkn
83+
84+
# Collect logs from all pipelineruns using Tekton CLI
85+
/tmp/tkn pipelinerun list -A > /tmp/k8s-artifacts/pipelinerun-list.txt 2>&1 || true
86+
for pr in $(kubectl get pipelineruns -A -o jsonpath='{range .items[*]}{.metadata.namespace}{" "}{.metadata.name}{"\n"}{end}'); do
87+
ns=$(echo $pr | awk '{print $1}')
88+
name=$(echo $pr | awk '{print $2}')
89+
/tmp/tkn pipelinerun logs $name -n $ns > /tmp/k8s-artifacts/pipelinerun-logs-${ns}-${name}.log 2>&1 || true
90+
done
91+
7992
- name: Upload Kubernetes artifacts
8093
if: failure()
8194
uses: actions/upload-artifact@v7

0 commit comments

Comments
 (0)