diff --git a/packages/core/testing/images/e2e-sandbox/Dockerfile b/packages/core/testing/images/e2e-sandbox/Dockerfile index fdb2ee54..d67dec13 100755 --- a/packages/core/testing/images/e2e-sandbox/Dockerfile +++ b/packages/core/testing/images/e2e-sandbox/Dockerfile @@ -9,7 +9,7 @@ ARG TARGETOS ARG TARGETARCH RUN apt update -q -RUN apt install -yq --no-install-recommends genisoimage ca-certificates qemu-kvm qemu-utils iproute2 iptables wget xz-utils netcat curl jq make git +RUN apt install -yq --no-install-recommends psmisc genisoimage ca-certificates qemu-kvm qemu-utils iproute2 iptables wget xz-utils netcat curl jq make git RUN curl -sSL "https://github.com/siderolabs/talos/releases/download/v${TALOSCTL_VERSION}/talosctl-${TARGETOS}-${TARGETARCH}" -o /usr/local/bin/talosctl \ && chmod +x /usr/local/bin/talosctl RUN curl -sSL "https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/${TARGETOS}/${TARGETARCH}/kubectl" -o /usr/local/bin/kubectl \ diff --git a/packages/core/testing/images/e2e-sandbox/entrypoint.sh b/packages/core/testing/images/e2e-sandbox/entrypoint.sh index 1e4a8b98..edfac68e 100755 --- a/packages/core/testing/images/e2e-sandbox/entrypoint.sh +++ b/packages/core/testing/images/e2e-sandbox/entrypoint.sh @@ -17,36 +17,16 @@ while [ $# -gt 0 ]; do esac done -ALL_PROCS=$(ps -eo pid=,ppid=,comm=) - -get_descendants() { - PARENT="$1" - echo "$PARENT" - echo "$ALL_PROCS" | while read -r PID PPID CMD; do - PID=$(echo "$PID" | tr -d ' ') - PPID=$(echo "$PPID" | tr -d ' ') - if [ "$PPID" = "$PARENT" ]; then - echo "$PID" - get_descendants "$PID" - fi - done -} - -is_own_tree() { - PID="$1" - echo "$DESCENDANTS" | grep -q -x "$PID" -} - check_once() { - DESCENDANTS="$(get_descendants "$SELF_PID" | sort -u)" + OWN_PIDS=$(pstree -p $$ | grep -o '[0-9]\+' | sort -u) + ALL_PROCS=$(ps -eo pid=,comm=) + EXTERNAL_PIDS=$( - echo "$ALL_PROCS" | while read -r PID PPID CMD; do + echo "$ALL_PROCS" | while read -r PID CMD; do PID=$(echo "$PID" | tr -d ' ') CMD=$(echo "$CMD" | tr -d ' ') - if is_own_tree "$PID"; then - continue - fi + echo "$OWN_PIDS" | grep -q -x "$PID" && continue case "$CMD" in *qemu*) continue ;;