@@ -19,6 +19,10 @@ mzcompose() {
1919 stdbuf --output=L --error=L bin/ci-builder run " $builder " bin/mzcompose --find " $BUILDKITE_PLUGIN_MZCOMPOSE_COMPOSITION " " $@ "
2020}
2121
22+ kubectl () {
23+ bin/ci-builder run stable kubectl --context=" $K8S_CONTEXT " " $@ "
24+ }
25+
2226faketty () {
2327 script -qfc " $( printf " %q " " $@ " ) " /dev/null
2428}
@@ -99,7 +103,7 @@ cleanup() {
99103 printf " \n%s" " $BUILDKITE_LABEL : test timed out" >> run.log
100104 fi
101105
102- echo " --- Post command steps"
106+ ci_unimportant_heading " Post command steps"
103107 # Run before potential "run down" in coverage
104108 docker ps --all --quiet | xargs --no-run-if-empty docker inspect | jq '
105109 .[]
@@ -126,6 +130,47 @@ cleanup() {
126130 ps aux | sed -E " s/\S*mzp_\S*/[REDACTED]/g" > ps-aux.log
127131 docker stats --all --no-stream > docker-stats.log
128132
133+ if [ " $BUILDKITE_PLUGIN_MZCOMPOSE_COMPOSITION " = " orchestratord" ]; then
134+ ci_unimportant_heading " orchestratord test: Uploading logs..."
135+ K8S_CLUSTER_NAME=kind
136+ K8S_CONTEXT=" kind-$K8S_CLUSTER_NAME "
137+ for pod in $( kubectl get pods -o name | grep -v -E ' kubernetes|minio|cockroach|redpanda' ) ; do
138+ kubectl logs --prefix=true " $pod " & >> kubectl-get-logs.log || true
139+ kubectl logs --previous --prefix=true " $pod " & >> kubectl-get-logs-previous.log || true
140+ done
141+ kubectl get events > kubectl-get-events.log || true
142+ kubectl get all > kubectl-get-all.log || true
143+ kubectl get events > kubectl-get-events.log || true
144+ kubectl get all > kubectl-get-all.log || true
145+ kubectl describe all | awk '
146+ BEGIN { redact=0 }
147+ /^[[:space:]]*Environment:/ {
148+ indent = match($0, /[^ ]/) - 1
149+ print substr($0, 1, indent) "Environment: [REDACTED]"
150+ redact = 1
151+ next
152+ }
153+ redact {
154+ current_indent = match($0, /[^ ]/) - 1
155+ if (current_indent <= indent || NF == 0) {
156+ redact = 0
157+ } else {
158+ next
159+ }
160+ }
161+ { print }
162+ ' > kubectl-describe-all.log || true
163+ kubectl get pods -o wide > kubectl-pods-with-nodes.log || true
164+
165+ kubectl -n kube-system get events > kubectl-get-events-kube-system.log || true
166+ kubectl -n kube-system get all > kubectl-get-all-kube-system.log || true
167+ kubectl -n kube-system describe all > kubectl-describe-all-kube-system.log || true
168+
169+ mapfile -t artifacts < <( printf " kubectl-get-logs.log\nkubectl-get-logs-previous.log\nkubectl-get-events.log\nkubectl-get-all.log\nkubectl-describe-all.log\nkubectl-pods-with-nodes.log\nkubectl-get-events-kube-system.log\nkubectl-get-all-kube-system.log\nkubectl-describe-all-kube-system.log\nkail-output.log\n" )
170+ artifacts_str=$( IFS=" ;" ; echo " ${artifacts[*]} " )
171+ buildkite-agent artifact upload " $artifacts_str "
172+ fi
173+
129174 mv " $cores " . || true
130175
131176 if find cores -name ' core.*' | grep -q . ; then
@@ -174,7 +219,7 @@ cleanup() {
174219 mapfile -t artifacts < <( printf " run.log\nservices.log\njournalctl-merge.log\nnetstat-ant.log\nnetstat-panelot.log\nps-aux.log\ndocker-inspect.log\n" ; find . -name ' junit_*.xml' -printf ' %P\n' ; find . -maxdepth 1 -name ' mz_debug_*.log' -printf ' %P\n' ; find . -maxdepth 1 -name ' slt*.diff' -printf ' %P\n' )
175220 artifacts_str=$( IFS=" ;" ; echo " ${artifacts[*]} " )
176221
177- echo " --- Running trufflehog to scan artifacts for secrets & uploading artifacts"
222+ ci_unimportant_heading " Running trufflehog to scan artifacts for secrets & uploading artifacts"
178223 {
179224 bin/ci-builder run " $builder " trufflehog --no-update --no-verification --json --exclude-detectors=coda,dockerhub,box,npmtoken,github,snykkey,eightxeight,sumologickey,miro,fmfw,logzio,qase,cannyio,uplead,tatumio filesystem " ${artifacts[@]} " | trufflehog_jq_filter_logs > trufflehog.log
180225 } &
@@ -187,7 +232,7 @@ cleanup() {
187232 buildkite-agent artifact upload " $artifacts_str " || true
188233 } &
189234 wait
190- echo " --- Annotating errors"
235+ ci_unimportant_heading " Annotating errors"
191236 bin/ci-builder run " $builder " bin/ci-annotate-errors --test-cmd=" $TEST_CMD " --test-desc=" $TEST_DESC " --test-result=" $TEST_RESULT " " ${artifacts[@]} " trufflehog.log > ci-annotate-errors.log || CI_ANNOTATE_ERRORS_RESULT=$?
192237 buildkite-agent artifact upload " ci-annotate-errors.log" &
193238
0 commit comments