Skip to content

Commit 5ddee5c

Browse files
committed
Merge remote-tracking branch 'origin/master' into search/public-preview
2 parents e69a443 + 85d4a02 commit 5ddee5c

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

docker/mongodb-agent/setup-agent-files.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ SCRIPTS_DIR="/opt/scripts"
88
# readiness always returns failure
99
setup_dummy_probes() {
1010
echo "Setting up dummy probe scripts..."
11-
cp /usr/local/bin/dummy-probe.sh "$SCRIPTS_DIR/probe.sh"
12-
cp /usr/local/bin/dummy-readinessprobe "$SCRIPTS_DIR/readinessprobe"
11+
cp --remove-destination /usr/local/bin/dummy-probe.sh "$SCRIPTS_DIR/probe.sh"
12+
cp --remove-destination /usr/local/bin/dummy-readinessprobe "$SCRIPTS_DIR/readinessprobe"
1313
echo "Dummy probe scripts ready"
1414
}
1515

scripts/evergreen/e2e/dump_diagnostic_information.sh

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -172,22 +172,21 @@ dump_pod_logs() {
172172

173173
# note that this file may get empty if the logs have already grew too much - seems it's better to have it explicitly empty then just omit
174174
kubectl --context="${context}" logs -n "${namespace}" "${pod}" | jq -c -r 'select( .logType == "agent-launcher-script") | .contents' 2> /dev/null > "logs/${prefix}${pod}-launcher.log"
175-
else
176-
# for all other pods we want each log per container from kubectl
177-
for container in $(kubectl --context="${context}" get pods -n "${namespace}" "${pod}" -o jsonpath='{.spec.containers[*].name}'); do
178-
echo "Writing log file for pod ${pod} - container ${container} to logs/${prefix}${pod}-${container}.log"
179-
kubectl --context="${context}" logs -n "${namespace}" "${pod}" -c "${container}" > "logs/${prefix}${pod}-${container}.log"
175+
fi
180176

181-
# Check if the container has restarted by examining its restart count
182-
restartCount=$(kubectl --context="${context}" get pod -n "${namespace}" "${pod}" -o jsonpath="{.status.containerStatuses[?(@.name=='${container}')].restartCount}")
177+
for container in $(kubectl --context="${context}" get pods -n "${namespace}" "${pod}" -o jsonpath='{.spec.containers[*].name}'); do
178+
echo "Writing log file for pod ${pod} - container ${container} to logs/${prefix}${pod}-${container}.log"
179+
kubectl --context="${context}" logs -n "${namespace}" "${pod}" -c "${container}" > "logs/${prefix}${pod}-${container}.log"
183180

184-
if [ "${restartCount}" -gt 0 ]; then
185-
echo "Writing log file for restarted ${pod} - container ${container} to logs/${prefix}${pod}-${container}-previous.log"
186-
kubectl --context="${context}" logs --previous -n "${namespace}" "${pod}" -c "${container}" > "logs/${prefix}${pod}-${container}-previous.log" || true
187-
fi
181+
# Check if the container has restarted by examining its restart count
182+
restartCount=$(kubectl --context="${context}" get pod -n "${namespace}" "${pod}" -o jsonpath="{.status.containerStatuses[?(@.name=='${container}')].restartCount}")
188183

189-
done
190-
fi
184+
if [ "${restartCount}" -gt 0 ]; then
185+
echo "Writing log file for restarted ${pod} - container ${container} to logs/${prefix}${pod}-${container}-previous.log"
186+
kubectl --context="${context}" logs --previous -n "${namespace}" "${pod}" -c "${container}" > "logs/${prefix}${pod}-${container}-previous.log" || true
187+
fi
188+
189+
done
191190

192191
if kubectl --context="${context}" exec "${pod}" -n "${namespace}" -- ls /var/log/mongodb-mms-automation/automation-agent-stderr.log &>/dev/null; then
193192
kubectl --context="${context}" cp "${namespace}/${pod}:/var/log/mongodb-mms-automation/automation-agent-stderr.log" "logs/${prefix}${pod}-agent-stderr.log" &> /dev/null

0 commit comments

Comments
 (0)